rhandsontable
rhandsontable copied to clipboard
Table is not visible with dashboard sidebar mini enabled
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:
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):
Step 3: re-collapse sidebar and voila! this is now showing:
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.
@jrowen yes the issue only appears once at first.
Issue raised shinydashboard repo
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.