My shiny app has 3 tabPanel in mainPanel, each tabPanel has their own sidebarPanel. I use shinyBS to set sidebarPanel "show and Hide"
bsButton("showpanel", "Show/Hide sidebar",icon = icon("toggle-off"), type = "toggle",style = "info", value = TRUE)
In server
observeEvent(input$showpanel, {
if(input$showpanel == TRUE) {
removeCssClass("Main", "col-sm-12")
addCssClass("Main", "col-sm-8")
shinyjs::show(id = "Sidebar")
shinyjs::enable(id = "Sidebar")
}
else {
removeCssClass("Main", "col-sm-8")
addCssClass("Main", "col-sm-12")
shinyjs::hide(id = "Sidebar")
}
})
I test couple times, 2 tabs work like I expected, but the tab with plots (I use plotly), it appears hiding sidebar but the plots are not automatic stretching out until I click the other tab and go back Plot tab. So if I want to see the plots with full screen, I need to do extra by clicking another tab, and come back.
How do I fix this issue?
Thanks