title: Shiny + DT: how to make datatable reactive?
body: <p>I have an issue while trying to make datatable reactive within a shiny app (from DT package). Here is my reproducible example:</p>
  
  <p>ui.r</p>
  
  <pre><code>dashboardPage(
  
    dashboardHeader(title = "TEST reactive DT"),
  
    dashboardSidebar(
      sidebarMenu(
        menuItem("See data", tabName = "db"),
        menuItem("Test", tabName = "test")),
        radioButtons("rb1", label = "Select data", 
                   choices = list("IRIS" = "iris", "CARS" = "cars"),
                   selected = "iris")
      ),
  
    dashboardBody(
      tabItems(
        tabItem(tabName = "db",
                h4("Show selected dataset"),
                fluidRow(DT::dataTableOutput('tbl')) #THIS DOES NOT WORK (NOT REACTIVE)
                ),
        tabItem(tabName = "test",
                h4("Test tab"),
                fluidRow(column(3, verbatimTextOutput("value"))) #THIS WORKS
                )
        )
      )
  )  
  </code></pre>
  
  <p>server.r</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  
  server &lt;- function(input, output, session) {
  
    output$value &lt;- renderPrint({ input$rb1 })
  
    data &lt;- reactive({
      switch(input$rb1,
             "iris" = iris,
             cars)
    })
  
    action &lt;- dataTableAjax(session, cars)  # HOW SHOULD I SPECIFY? data() INSTEAD OF cars DOES NOT WORK
    widget &lt;- datatable(cars,  # HOW SHOULD I SPECIFY? data() INSTEAD OF cars DOES NOT WORK
                       class = 'display cell-border compact',
                       filter = 'top',
                       server = TRUE,
                       options = list(ajax = list(url = action))
    )
  
    output$tbl &lt;- DT::renderDataTable(widget)
  }
  </code></pre>
  
  <p>As you can see in the 'Test tab', radiobutton selection is updated at change. However I can't understand how this should be integrated within the dataTableAjax and dataTable functions, can you explain/ help me solve this issue?</p>
  
  <p>Many thanks in advance for your help!</p>
  
  <p>Best regards</p>