shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

handsontable is not visible with dashboard sidebar mini enabled

Open dylancis opened this issue 6 years ago • 1 comments

Loading the app and collapsing the sidebar makes the handsontable widget hidden by default. The only to have it showing up is to expand the sidebar, expand the menu item and then re-collapse again the sidebar then only you will see it. The issue only happens the first time. I have a reproducible example here:

## app.R ##
library(shiny)
library(shinydashboard)
library(shinyjs)
library(rhandsontable)
DF = data.frame(val = 1:3, big = LETTERS[1:3],
                small = letters[1:3], by = "days", length.out = 3,
                stringsAsFactors = FALSE)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(width = 350, sidebarMenu(menuItem('Test', icon = icon('phone'), tabName = 'sampletabname',
                                       # ISSUE HERE
                                        rhandsontable(DF, width = 350, height = 200) %>%
                                          hot_table(highlightCol = TRUE, highlightRow = TRUE)))
                   ),
  dashboardBody(h3('Test app'),
                useShinyjs())
)

server <- function(input, output) {
  runjs('
        var el2 = document.querySelector(".skin-blue");
        el2.className = "skin-blue sidebar-mini";
        ')
}

shinyApp(ui, server)

Step 1: open the app and collapse sidebar straight away: image

Step 2: expand sidebar and menu-item (you may need to click on the empty div to force the handson table to show up, maybe another issue here): image

Step 3: re-collapse sidebar and voila! this is now showing: image

I have discussed the above issue with rhandsontable repo owner here and he believed the issue comes from shinydashboard.

dylancis avatar Jan 23 '19 09:01 dylancis

Any update on this one? I ran into this as well while trying to use these two great libraries and it's forcing me to use a much less efficient method to receive inputs.

Nivvinabon avatar Aug 24 '20 18:08 Nivvinabon