1

Is it possible to add a common scroll Y for more than one datatables which are side to side?

## app.R ##
library(shiny)
library(shinydashboard)
library(DT)
ui <- dashboardPage(
  dashboardHeader(title = "My Chart"),
  dashboardSidebar(
    width = 0
  ),
  dashboardBody(
    
         column(width = 6,
                DT::dataTableOutput("trace_table"),style = "height:500px; overflow-y: scroll;overflow-x: scroll;",
         ),
         column(width = 6,
                DT::dataTableOutput("trace_table2"),style = "height:500px; overflow-y: scroll;overflow-x: scroll;",
         )
    ))
server <- function(input, output) { 
  #Plot for Trace Explorer
  
  output$trace_table <- renderDataTable({
    
    datatable(cbind(mtcars,mtcars), options = list(paging = FALSE))
    
  })
  output$trace_table2 <- renderDataTable({
    
    datatable(cbind(mtcars,mtcars), options = list(paging = FALSE))
    
  })
}
shinyApp(ui, server)
firmo23
  • 7,490
  • 2
  • 38
  • 114
  • This post might be helpful: https://stackoverflow.com/questions/62850537/synchronize-horizontal-scrollbars-for-datatables-in-r-shiny-application – Mel G Jul 25 '22 at 00:49

1 Answers1

1
ui <- dashboardPage(
  dashboardHeader(title = "My Chart"),
  dashboardSidebar(
    width = 0
  ),
  dashboardBody(
    column(
      width = 12,
      tags$div(
        style = "max-height:500px; overflow-y: scroll; overflow-x: scroll;",
        splitLayout(
          DTOutput("trace_table"),
          DTOutput("trace_table2")
        )
      )
    )
  )
)
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
  • any suggestion on shiny issue? https://stackoverflow.com/questions/73545778/subset-a-bupar-process-map-based-on-click-on-a-bar-of-activity-frequency-bar-gra – firmo23 Aug 31 '22 at 08:48