title: Shiny with reactive inputs and "Go" button
body: <p>I have a shiny App, I wanted to be reactive for the inputs choice and show the datatable when I press the "Go" button.
  For inputs I want to have the choice between "All value" of my variable and each value.
  I have some problem to fix my app.</p>
  
  <h1>First try</h1>
  
  <pre><code>library(shiny)
  library(dplyr)
  library(DT)
  
  # my data
  bdd &lt;- tibble(BA = rep(LETTERS, 2), MA = as.character(1:52),
                YES = paste(BA, MA, sep = ""))
  
  
  
  ui &lt;- fluidPage(
    titlePanel("BA"),
    column(4,
           uiOutput("filter1"),
           uiOutput("filter2"),
           uiOutput("filter3"),
           actionButton("button", "GO")),
    column(8,
           DT::dataTableOutput("my_table"))
  )
  
  server &lt;- function(input, output, session) {
  
  
    All_BA &lt;- reactive({
      bdd %&gt;% distinct(BA) 
    })
    # my reactives inputs for filter 1
    output$filter1 &lt;- renderUI({
      selectInput("filter1", "Filtre numéro 1", 
                  choices = c("All_BA", bdd %&gt;% select(BA)))
    })
  
    All_MA &lt;- reactive({
      bdd %&gt;% filter(BA %in% input$filter1) %&gt;%
        distinct(MA)
    }) 
    # my reactives inputs for filter 2
    output$filter2 &lt;- renderUI({
      selectInput("filter2", "Filtre numéro 2",
                  choices = c("All_MA", bdd %&gt;% filter(BA %in% input$filter1) %&gt;% select(MA)), 
                  selected = "All_MA")
    })
  
    All_Y &lt;- reactive({
      bdd %&gt;% filter(BA %in% input$filter1 |
                       MA %in% input$filter2) %&gt;% distinct(YES) 
    })
    # my reactives inputs for filter 3
    output$filter3 &lt;- renderUI({
      selectInput("filter3", "Filtre numéro 3", 
                  choices =  c("All_Y", bdd %&gt;% filter(BA %in% input$filter1,
                                                       MA %in% input$filter2) %&gt;% select(YES)),
                  selected = "All_Y")
    })
  
    df &lt;- eventReactive(input$button, {
      bdd %&gt;% filter(BA %in% input$filter1,
                     MA %in% input$filter2,
                     YES %in% input$filter3)
    })
  
  
    output$my_table &lt;- DT::renderDataTable({
      df()
  
    })
  
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <h1>second try (didn't work cause of rectivity problem and the code doesnt seem to be optimized)</h1>
  
  <pre><code>library(shiny)
  library(dplyr)
  library(DT)
  
  # my data
  bdd &lt;- tibble(BA = rep(LETTERS, 2), MA = as.character(1:52),
                YES = paste(BA, MA, sep = ""))
  
  
  
  ui &lt;- fluidPage(
    titlePanel("BA"),
    column(4,
           uiOutput("filter1"),
           uiOutput("filter2"),
           uiOutput("filter3"),
           actionButton("button", "GO")),
    column(8,
           DT::dataTableOutput("my_table"))
  )
  
  server &lt;- function(input, output, session) {
  
  
    All_BA &lt;- reactive({
      bdd %&gt;% distinct(BA) 
    })
    # my reactives inputs for filter 1
    if(input$filter1 == "All_BA"){
      bdd &lt;- reactive({
        bdd %&gt;%
          filter(BA %in% All_BA())
      })
    }else{
      bdd &lt;- reactive({
        bdd %&gt;%
          filter(BA %in% input$filter1)
      })
    }
    output$filter1 &lt;- renderUI({
      selectInput("filter1", "Filtre numéro 1", 
                  choices = c("All_BA", bdd() %&gt;% select(BA)))
    })
  
    All_MA &lt;- reactive({
      bdd() %&gt;% filter(BA %in% input$filter1) %&gt;%
        distinct(MA)
    }) 
    # my reactives inputs for filter 2
    if(input$filter2 == "All_MA"){
      bdd2 &lt;- reactive({
        bdd() %&gt;%
          filter(MA %in% All_MA())
      })
    }else{
      bdd2 &lt;- reactive({
        bdd() %&gt;%
          filter(MA %in% input$filter2)
      })
    }
    output$filter2 &lt;- renderUI({
      selectInput("filter2", "Filtre numéro 2",
                  choices = c("All_MA", bdd2() %&gt;% select(MA)), 
                  selected = "All_MA")
    })
  
    All_Y &lt;- reactive({
      bdd2 %&gt;% filter(BA %in% input$filter1 |
                        MA %in% input$filter2) %&gt;% distinct(YES) 
    })
    # my reactives inputs for filter 3
    if(input$filter3 == "All_Y"){
      bdd3 &lt;- reactive({
        bdd2() %&gt;%
          filter(YES %in% All_Y())
      })
    }else{
      bdd3 &lt;- reactive({
        bdd2() %&gt;%
          filter(YES %in% input$filter3)
      })
    }
    output$filter3 &lt;- renderUI({
      selectInput("filter3", "Filtre numéro 3", 
                  choices =  c("All_Y", bdd3() %&gt;% select(YES)),
                  selected = "All_Y")
    })
  
    df &lt;- eventReactive(input$button, {
      bdd %&gt;% filter(BA %in% input$filter1,
                     MA %in% input$filter2,
                     YES %in% input$filter3)
    })
  
  
    output$my_table &lt;- DT::renderDataTable({
      df()
  
    })
  
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>