Is there a way to search by column with Shiny'

2019-02-18 22:24发布

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?

1条回答
ら.Afraid
2楼-- · 2019-02-18 22:39

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)

查看更多
登录 后发表回答