Horizontal scroll bar for Shiny Dashboard


#1

How can I add a horizontal scroll bar to my Shiny Dashboard?
The vertical scroll bar appears automatically, but not the horizontal one, some tables are so wide that everything does not fit on the screen.


#2

You need to modify css of the container where your tables are rendered.
See here for a few ways to do this. Since you haven't provided reproducible example, this is as much as I can help you.


#3

Thanks will try your suggestion, here is a snippet of my code where I would like to add the horizontal scrollbar:

library(shiny)
library(shinydashboard)
library(plotly)
library(ggiraph)
library(rpivotTable)

#SHINY

#HEADER
header<-dashboardHeader(title = "Silica Dashboard")

#SIDEBAR
sidebar<-  dashboardSidebar(width = 300,
                            sidebarMenu(
                              menuItem("Dashboard", tabName = "Dashboard", icon = icon("dashboard")),
                              
                             
                              menuItem(text = "Tables", icon = icon("table"),
                                       menuItem(text = "AUM Per Fund", tabName = "AUMFundTable"),
                                   
                                       startExpanded = FALSE)
                            )
   
)

#BODY
body<-dashboardBody(
  
  
  
  tabItems(
  
    
    tabItem(tabName = "AUMFundTable",
            h4("AUM Table"),
          
            rpivotTableOutput("AUMFundTable")
    )
    
  )
)

#---------------------------------------------------------------------------------------------------------------------------------
#APP
shinyApp(
  
  #UI
  ui <- dashboardPage(header, sidebar, body),
  
  
  #SERVER
  server <- function(input, output) { 
    
 

    #*************************************************************************************** 
    #AUM Table
    
    
    output$AUMFundTable <- renderRpivotTable({rpivotTable(AUM_table})
    

  })

#4

I think I am doing something wrong as I still cannot get it to work, below a snippet of the code I am trying to add the horizontal scrollbar to:

library(shiny)
library(shinydashboard)
library(plotly)
library(ggiraph)
library(rpivotTable)

#SHINY

#HEADER
header<-dashboardHeader(title = "Silica Dashboard")

#SIDEBAR
sidebar<-  dashboardSidebar(width = 300,
                            sidebarMenu(
                              menuItem("Dashboard", tabName = "Dashboard", icon = icon("dashboard")),
                              
                             
                              menuItem(text = "Tables", icon = icon("table"),
                                       menuItem(text = "AUM Per Fund", tabName = "AUMFundTable"),
                                   
                                       startExpanded = FALSE)
                            )
   
)

#BODY
body<-dashboardBody(
  
  
  
  tabItems(
  
    
    tabItem(tabName = "AUMFundTable",
            h4("AUM Table"),
          
            rpivotTableOutput("AUMFundTable")
    )
    
  )
)

#---------------------------------------------------------------------------------------------------------------------------------
#APP
shinyApp(
  
  #UI
  ui <- dashboardPage(header, sidebar, body),
  
  
  #SERVER
  server <- function(input, output) { 
    
 

    #*************************************************************************************** 
    #AUM Table
    
    
    output$AUMFundTable <- renderRpivotTable({rpivotTable(AUM_table})
    

  })

#5

Got it working, had to add this code above the pivot table:

 tags$head(tags$style( type = 'text/css',  '.rpivotTable{ overflow-x: scroll; }')),