I would like to change the color of the selected row from blue to something else. This is possible without using the bslib package and themes, but I would like to use the theme, and still be able to change the color.
This works:
library(shiny)
library(DT)
library(bslib)
ui <- fluidPage(
#theme = bs_theme(),
tags$style(HTML('table.dataTable tr.selected td, table.dataTable td.selected {background-color: pink !important;}')),
mainPanel(DT::dataTableOutput('mytable'))
)
server <- function(input, output,session) {
output$mytable = DT::renderDataTable(
datatable(mtcars)
)
}
runApp(list(ui = ui, server = server))
Uncommenting the theme line reverts the color back to blue.
I am stumped. Any ideas??
try this:
ui <- fluidPage(
theme = bs_theme(),
tags$style(HTML("
.table.dataTable tbody td.active, .table.dataTable tbody tr.active td {
background-color: red!important;}
")),
mainPanel(DT::dataTableOutput('mytable'))
)
server <- function(input, output,session) {
output$mytable = DT::renderDataTable(
datatable(mtcars)
)
}
runApp(list(ui = ui, server = server))