有没有办法使用 Shiny 更新的 DT::renderDataTable 和 DT::dataTableOutput 按列搜索? [英] Is there a way to search by column with Shiny's updated DT::renderDataTable and DT::dataTableOutput?
问题描述
Shiny 似乎改变了数据表的实现.这是什么原因?
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?
推荐答案
它当然仍然存在,只是似乎不再是默认设置了.
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")
}
))
我刚刚访问了位于 https://rstudio.github.io/DT/<的网站文档以获取数据表/a> 并且在首页他们说如何使用 filter
参数
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
确保您使用的是最新版本的 Shine 和 DT(使用 GitHub 版本,因为过去 2 周内完成了大量工作)
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)
这篇关于有没有办法使用 Shiny 更新的 DT::renderDataTable 和 DT::dataTableOutput 按列搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!