jrowen / rhandsontable

A htmlwidgets implementation of Handsontable.js
http://jrowen.github.io/rhandsontable/
Other
383 stars 148 forks source link

Table is not visible with dashboard sidebar mini enabled #244

Open dylancis opened 6 years ago

dylancis commented 6 years ago

Loading the app and collapsing the sidebar makes the handsontable 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. 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

jrowen commented 5 years ago

I wasn't able to exactly reproduce this issue. I was able to confirm that the rhandsontable is not appearing the first time the Test section is expanded and collapsed, but it does appear all subsequent times. This appears to be an issue with shinydashboard not playing well with a rhandsontable in the sidebar, so I'd suggest logging an issue with shinydashboard. We can certainly update the css for rhandsontable if needed.

dylancis commented 5 years ago

@jrowen yes the issue only appears once at first.

dylancis commented 5 years ago

Issue raised shinydashboard repo

Nivvinabon commented 4 years ago

I'd like to second dylancis' observation I ran into this as well recently, but in addition to the table not showing up at first, I've noticed that if I type anything in it won't display that value. It'd be great if I could use this library with shinydashboard, but I can't give up shinydashboard just for using this input type.