title: Selecting input that is filtered based on previously selected inputs
body: <p>I'm working on a project where table is filtered based on the Inputs provided by the user. There are three selectInput conditions.</p>
  <p>For better understanding lets assume the mtcars data. User can first select the number of cylinders, then the user should see a selectInput list of number of gears filtered for given value of cylinder. (**for instance, if number of cylinder is 4, then number of gears should be either 4,3,5 **)</p>
  <p>Similarly, after selecting the Number of Cylinders and Number of gears the user must see the value of Transmission type as either 0,1.
  The table should be updated and filtered based on the selected inputs.</p>
  <p>I have tried the given code. Please help me.</p>
  <pre><code>#loading libraries
  library(tidyverse)
  library(shiny)
  library(DT)
  
  #using mtcars as dataset
  df &lt;- read.csv(&quot;https://gist.githubusercontent.com/seankross/a412dfbd88b3db70b74b/raw/5f23f993cd87c283ce766e7ac6b329ee7cc2e1d1/mtcars.csv&quot;)
  
  # Define UI for application
  ui &lt;- fluidPage(
    
    # Application title
    titlePanel(&quot;Details of Given Cars&quot;),
    
    # Sidebar for input  filter
    sidebarLayout(
      sidebarPanel(
        selectInput(&quot;cylinder&quot;,&quot;Number of Cylinders&quot;,unique(df$cyl)),
        selectizeInput(&quot;gears&quot;,&quot;Number of gears&quot;,choices = NULL),
        selectizeInput(&quot;gearbox&quot;,&quot;Transmission Type 'AUTO=0'&quot;,choices = NULL)
      ),
      
      # Show a table
      mainPanel(
        DT::DTOutput(&quot;table&quot;)
      )
    )
  )
  
  # Define server logic required
  server &lt;- function(input, output,session) {
    
    #----reactive calculations
    cyl_sel &lt;- reactive({
      df %&gt;% filter(cyl == input$cylinder)
    })
    
    
    observeEvent(cyl_sel(),{
      updateSelectizeInput(session,&quot;gears&quot;, choices = cyl_sel()$gear)
    # })
    
    
    gearbox_sel &lt;- reactive({
      cyl_sel() %&gt;% filter(am == input$gears)
    })
    
    observeEvent(gearbox_sel,{
      updateSelectizeInput(session,&quot;gearbox&quot;,choices = gearbox_sel()$am)
    
    
    output$table &lt;- DT::renderDT({
      df %&gt;% filter(cyl == input$cylinder,
                    gear == input$gears)
                   # am== input$gearbox) # commented because output is not shown when uncommented
      })
    })
  })
     
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/U68pV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U68pV.png" alt="Sample output (without Transmission Type)" /></a></p>