rshinyrpivottable

rpivotTable not fitting in my Shiny Dashboard page


I am using rpivoTable package in my shiny dashboard. The problem is that my tables has close to 25 variables (columns) whereas I am only able to view 10 columns. Rest are out of view and there's no slider also to view them.

Best,


Solution

  • I find one way -- add css to that pivot

    tags$head(tags$style( type = 'text/css',  '#pivot{ overflow-x: scroll; }')),
              rpivotTableOutput('pivot', width = "100%", height = "500px")
    

    for example

    UI

    library(shiny)
    library(rpivotTable)
    library(shinydashboard)
    shinyUI(dashboardPage(
      dashboardHeader(title = "example"),
      dashboardSidebar(disable = T),
      dashboardBody(
    
          tags$head(tags$style( type = 'text/css',  '#pivot{ overflow-x: scroll; }')),
          rpivotTableOutput('pivot', width = "100%", height = "500px")
      )
    
    ))
    

    server

    df=data.frame(lapply(1:25,function(i)i=rnorm(20)))
    colnames(df)=as.character(letters[1:25])
    
    shinyServer(function(input, output,session) {
    
      output$pivot <- renderRpivotTable({
        rpivotTable(data = df)
      })
    
    
    })