繁体   English   中英

如何为Shiny数据表添加列边框?

[英]How do you add column borders for a Shiny datatable?

我有一个闪亮的数据表,看起来像这样:

在此处输入图片说明

但是,我希望它在所有单元格周围都有完整的边框,以使其看起来更像一张Excel工作表。 我知道在闪亮表中,它就像调用bordered = T一样简单,但不适用于Shiny中的数据表。

这是我的UI代码:

      fluidRow(
        DT::dataTableOutput("stats_table", width = "95%")
      )

这是我的服务器代码:

output$stats_table <- DT::renderDataTable(DT::datatable({
  # Do not show a plot when the page first loads
  # Wait until the user clicks "Plot" button
  if (input$plot_graph_button == 0)
    return()

  data <- summary_table
  #### Do some filtering here ####
  data

}))

预先感谢您的帮助,我觉得这应该很容易解决,但是,我没有找到任何好的信息。 我确实意识到这纯粹是装饰性的,不会影响桌子的功能。

您可以使用cell-border stripe类。 在这里查看更多选项

 output$stats_table <- DT::renderDataTable({
               # Do not show a plot when the page first loads
               # Wait until the user clicks "Plot" button
               # if (input$plot_graph_button == 0)
               # return()

       data <- datatable(head(iris), class = 'cell-border stripe')
       #### Do some filtering here ####
       data

})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM