daj
daj

Reputation: 7183

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?

Upvotes: 4

Views: 3680

Answers (1)

DeanAttali
DeanAttali

Reputation: 26373

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)

Upvotes: 7

Related Questions