title: Dynamically pre-select row using DT in shiny
body: <p>I try to dynamically pre-select rows in shiny using DT and saw this question/answer: <a href="https://stackoverflow.com/questions/42077184/pre-select-rows-of-a-dynamic-dt-in-shiny">Pre-select rows of a dynamic DT in shiny</a>
  I do however need the 'native' appearance of DT with the intelligent column filters. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>library(shiny)
  library(DT)
  
  shinyApp(
      ui=shinyUI(
          fixedPage(
              radioButtons('selectedRows',
                           'select a row',
                           c(
                           "row one"="1",
                           "row two"="2")),
              DT::dataTableOutput('myTable')
          )
      )
  ,
  
  server=shinyServer(function(input, output) {
  
      selRows &lt;- reactiveValues(row=c())
  
      observe({
          validate(need(input$selectedRows, message=FALSE)) 
          selRows$row &lt;- as.numeric(input$selectedRows)
      })
  
      output$myTable &lt;- DT::renderDataTable ({
                                               mtcars[,1:5]
                                            },server=T,
                                              rownames = T,
                                              filter = "top",
                                              selection = list(mode='multiple',
                                                               selected = selRows$row))
  
      })
  ) 
  </code></pre>
  
  <p>Thanks!</p>