[英]How do you add column borders for a Shiny datatable?
I have a shiny datatable that looks like this: 我有一个闪亮的数据表,看起来像这样:
However, I want it to have full borders around all of the cells to make it look more like an excel sheet. 但是,我希望它在所有单元格周围都有完整的边框,以使其看起来更像一张Excel工作表。 I know in the shiny table it is as simple as calling
bordered = T
but that does not work for the datatable in Shiny. 我知道在闪亮表中,它就像调用
bordered = T
一样简单,但不适用于Shiny中的数据表。
This is my UI code: 这是我的UI代码:
fluidRow(
DT::dataTableOutput("stats_table", width = "95%")
)
And this is my server code: 这是我的服务器代码:
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
}))
Thank you in advance for the help, I feel like this should be a very easy fix, however, I am not finding any good information on it. 预先感谢您的帮助,我觉得这应该很容易解决,但是,我没有找到任何好的信息。 I do realize this is purely cosmetic and does not effect the functionality of the table.
我确实意识到这纯粹是装饰性的,不会影响桌子的功能。
You can use cell-border stripe
class. 您可以使用
cell-border stripe
类。 Check here for more options 在这里查看更多选项
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.