Reputation: 3308
I am using Datatable
in my shiny App
as I illustrate below. I am wondering, if there is any way to apply specific CSS styling
in a single column of Datatable
, for example I want the 1st column to be bold and having specific font.
Any pointer would be highly appreciated. Thanks,
library(shiny)
library(DT)
library(data.table)
ui = fluidPage(
DT::dataTableOutput("mytable1", height = '400px')
)
server = function(input, output, session) {
DF_DT = data.frame(matrix("4", nr = 20, nc = 7)); colnames(DF_DT) = LETTERS[1:7]
output$mytable1 = renderDataTable({
DF_DT}, options = list(columnDefs = list(list(width = '350px', targets = 1, className = 'dt-center', fontSize = '50px')))
)
}
shinyApp(ui = ui, server = server)
Upvotes: 1
Views: 691
Reputation: 12819
One possibility is:
ui = fluidPage(
tags$head(tags$style(HTML("
.dt-center {
font-weight: bold;
}
"))),
DT::dataTableOutput("mytable1", height = '400px')
)
For reference see https://shiny.rstudio.com/articles/css.html
Upvotes: 2