I am trying to set the highlight color for a selected row in a DataTable in my shiny app. Basically I want the color of selected rows to be say red rather than blue. However
This should do the job:
#rm(list = ls())
library(shiny)
library(DT)
ui <- basicPage(
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))