简体   繁体   中英

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. I know in the shiny table it is as simple as calling bordered = T but that does not work for the datatable in Shiny.

This is my UI code:

      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. 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

})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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