Skip to content

Instantly share code, notes, and snippets.

@rcgalbo
Created February 1, 2018 21:03
Show Gist options
  • Save rcgalbo/ad17c52ad694f3580ced36c157eed3e5 to your computer and use it in GitHub Desktop.
Save rcgalbo/ad17c52ad694f3580ced36c157eed3e5 to your computer and use it in GitHub Desktop.
Add a horizontal scroll bar to datatable in shinydashboard
ui<-fluidPage(DT::dataTableOutput("wideTable"))
server<-function(input, output) {
output$wideTable <- DT::renderDataTable({
table <- do.call(cbind, lapply(1:100, function(i) 1:1000))
colnames(table) <- paste0("name.", 1:100)
DT::datatable(table, options = list(scrollX = TRUE))
})
}
shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment