Reputation: 1858
Consider the following example:
library(DT)
L <- 10
datatable(
data.frame(
var1 = sapply(1:L, function(x)
paste("<X>",paste0(x,
letters,
LETTERS,
"\n",
collapse=" "))),
var2 = round(rnorm(L),2)
)
)
And here is the output:
I would like to either hide or format (change the background colour and the font family) the top part of the output that contains "Show X entries" together with the "Search" tab. I've found ways out formatting the rows and the headers by injecting CSS and JS code into the options
of datatable
and using the formatStyle
function, but I can't find a way of dealing with the filter pane.
Just in case it makes any difference, I intend to use the outputs in a Shiny web-app.
Many thanks in advance.
Upvotes: 1
Views: 898
Reputation: 1145
With the dom argument you can select with parts of the datatable you want to show and in which order.
More info here: https://datatables.net/reference/option/dom
With the style argument you can change the style of the whole datatable by using the style argument. You can choose between: "default", "bootstrap", "bootstrap4", "foundation", "jqueryui", "material", "semanticui", "uikit".
More info here: https://datatables.net/manual/styling/
library(DT)
L <- 10
dataset <- data.frame(
var1 = sapply(1:L, function(x)
paste("<X>",paste0(x,
letters,
LETTERS,
"\n",
collapse=" "))),
var2 = round(rnorm(L),2)
)
datatable(dataset, style = 'bootstrap', options = list(
dom = 't')
)
Upvotes: 1