Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to search by column with Shiny's updated DT::renderDataTable and DT::dataTableOutput?

Shiny seems to have changed the implementation of data tables. What was the reason for this?

Unless I'm missing something, the new default looks like a step backwards. For one thing, they are missing the column-specific search boxes at the bottom of the table. Is there a way to replace that functionality?

like image 888
daj Avatar asked Mar 16 '23 18:03

daj


1 Answers

It certainly still exists, it just seems to not be the default anymore.

library(shiny)
runApp(shinyApp(
  ui = fluidPage(
    DT::dataTableOutput("table")
  ),
  server = function(input, output, session) {
    output$table <- DT::renderDataTable(cars, filter = "top")
  }
))

I just went to the website docs for datatable at https://rstudio.github.io/DT/ and on the front page they say how to use the filter parameter

Make sure you're using the most up to date version of both shiny and DT (use the GitHub version because a lot of work was done in the past 2 weeks)

like image 122
DeanAttali Avatar answered Mar 18 '23 16:03

DeanAttali