I am trying to build datatable with fixedheader, fixed rownames, and a title. That's the code i am using:
library(DT)
library(shiny)
ui <- basicPage(
DT::dataTableOutput("mytable")
)
server <- function(input, output) {
m = as.data.frame(round(matrix(rnorm(10000), 20), 5))
data<-datatable(
m, extensions = c('FixedColumns',"FixedHeader"),
caption ='long title',
options = list(
scrollX = TRUE, scrollY = 300,
paging=F,
fixedColumns = list(leftColumns = 1)
))
output$mytable = DT::renderDataTable({
data
})
}
shinyApp(ui, server)
When running the code you can see that the title is forcing the first column to take a new line. I tried using this code:
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: center;',
'long title'
)
It worked when the caption-side was set to bottom but not top
Any idea how i can keep the caption-side:top and make it work
Appreciate your help
Thanks