You can modify the width of the column filter in an R shiny datatable using the columnDefs
argument in the renderDT()
function. Here is an example code:
library(shiny)
library(DT)
ui <- fluidPage(
DTOutput("table")
)
server <- function(input, output) {
output$table <- renderDT({
datatable(iris,
filter = 'top',
options = list(
columnDefs = list(list(targets = "_all", width = "20%"))
))
})
}
shinyApp(ui, server)
In this code, we set columnDefs
to a list of one element which sets the width of all columns to 20%. You can modify this value to your desired width. The targets
argument specifies the target columns, "_all" selects all columns, but you can also specify individual column indexes or names.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-10-05 11:00:00 +0000
Seen: 9 times
Last updated: May 27 '21
How can one generate a list by using a portion of another list?
How can Swagger V3 use Schema Annotation to transform a List of Long to look like a List of String?
How can dote be eliminated from the menu items in HTML?
How can an EditForm validate a list object in MudBlazor?
How do you update a dataframe within a for loop in R after passing a list?
How can resetting a list be avoided during a loop?
What is the LINQ query to retrieve the employee with the second highest salary?
What is the method to sort CorrelationIDs that are linked with a specific OperationName?