【问题标题】:R Shiny, Remove Within-Column Filters from DataTablesR Shiny,从数据表中删除列内过滤器
【发布时间】:2013-11-26 02:35:47
【问题描述】:

[也发布在 Shiny Google Group 中]

我在尝试显示数据表时遇到了一些(我相信)意外行为。当我显示表格时,我的目标是删除大部分排序/分页/过滤/处理选项。到目前为止,设置 bSort=0, bProcessing=0, bPaginate=0, bInfo=0 似乎会产生所需的结果。但是,当我设置 bFilter=0 时,仅删除了右上角的“全局”过滤器框;列内过滤器框仍然存在(我希望 bFilter=0 删除所有过滤器框)。

任何人都可以帮助编写代码以删除列内过滤器框(请感谢您)。 [此外,我知道特定于列的格式选项,但迄今为止无法成功实施它们以消除列内格式]。我在下面包含了最少的代码来重现问题:

shinyUI(pageWithSidebar(

  #my code has a header panel;
  headerPanel("Table Example"),

  #my code has a sidebar panel;
  sidebarPanel(helpText("Stuff Here")),

  #table is displayed in the main panel;
  mainPanel(dataTableOutput("myTable"))
))


shinyServer(function(input, output) {

  #example dataTable that produces undesired result;
  output$myTable <- renderDataTable({
    as.data.frame(matrix(sample(1:10,100,replace=TRUE),nrow=20,ncol=10))
  }, options = list(bFilter=0, bSort=0, bProcessing=0, bPaginate=0, bInfo=0))

})

[行为出现在服务器和本地运行。闪亮的 0.7.0.99。使用谷歌浏览器]

提前致谢!

【问题讨论】:

    标签: r datatables shiny


    【解决方案1】:

    解决方案是简单地编辑与 myTable 输出对象关联的 css:

    即改变:

    mainPanel(dataTableOutput("myTable"))
    

    mainPanel(
      dataTableOutput("myTable"),
      tags$style(type="text/css", '#myTable tfoot {display:none;}')
    ) 
    

    【讨论】:

      猜你喜欢
      • 2020-03-02
      • 2014-06-29
      • 1970-01-01
      • 2019-08-09
      • 2019-03-22
      • 2021-02-05
      • 1970-01-01
      • 2020-10-25
      • 2013-09-09
      相关资源
      最近更新 更多