Reputation: 1
This is how my day column in the datatable appears:
I removed some of the columns to adjust the day column to make it to appear in single row instead of two rows. The date-column is now like this: '2022-' and in next line '11-24'. I want date column to be like this '2022-11-24'. How can I do this without using width parameter.
I tried all datatable parameters, but nothing seems to work.
Upvotes: 0
Views: 594
Reputation: 84529
Use the CSS white-space: nowrap
:
library(DT)
library(shiny)
dat <- mtcars
dat$test <- "2022-12-08"
ui <- fluidPage(
tags$head(
tags$style(HTML(
"
td {
white-space: nowrap;
}
"
))
),
DTOutput("dtable")
)
server <- function(input, output, session) {
output$dtable <- renderDT({
datatable(dat)
})
}
shinyApp(ui, server)
Upvotes: 1