Reputation: 8454
I would like to change the background color of the 'number of entries' and 'search box' at the top of the data table from white to -lets say- gray. Is this possible?
library(DT)
datatable(iris)
Upvotes: 0
Views: 983
Reputation: 84639
library(DT)
callback <- c(
"$('#DataTables_Table_0_length select').css('background-color', 'orange');",
"$('#DataTables_Table_0_filter input').css('background-color', 'yellow');"
)
datatable(iris, callback = JS(callback))
Upvotes: 2
Reputation: 6116
Use callback
argument:
Write JavaScript to select the HTML elements and change their CSS.
For example, I modified the background color using codes below. You can use similar approach to change the CSS of the search box.
DT::datatable(iris,elementId = "thistable",
callback = DT::JS("$('#thistable div[role=\"status\"]').css('background-color','red')"))
Upvotes: 0