Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Hide and show sidebar panel in shiny

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

Answer*

Draft saved
Draft discarded
Cancel
3
  • 1
    Hi Victor. I think you are answering the Tarun-Parmar comments on the answer from Mal_a. If so, the purpose here is to answer the main question. You could make another comment on that. Commented Nov 23, 2021 at 2:08
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Nov 23, 2021 at 2:09
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review Commented Nov 23, 2021 at 22:58

lang-r

AltStyle によって変換されたページ (->オリジナル) /