Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic sidebarMenu lost functionality #314

Open
analytichealth opened this issue Sep 27, 2022 · 0 comments
Open

Dynamic sidebarMenu lost functionality #314

analytichealth opened this issue Sep 27, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@analytichealth
Copy link

Using a dynamic sidebarMenu loses some functionality after update.
If you run this code, at first you can click on 'Menu item' to repeatedly hide and show 'Sub Menu 0'.
However, if you then click on the 'Update Sidebar' button you lose the functionality to hide and show the Sub Menu.

bs4Dash version: 2.1.0
R version: 4.0.3

library(bs4Dash)
ui <- dashboardPage(
  dashboardHeader(title = "Dynamic sidebar"),
  dashboardSidebar(
    sidebarMenuOutput("menu")
  ),
  dashboardBody(
    actionButton("go", "Update sidebar")
  )
)
server <- function(input, output) {
  r = reactiveVal(0)
  observeEvent(input$go, {
    r(r() + 1)
  })
  output$menu <- renderMenu({
    sidebarMenu(
      menuItem("Menu item", icon = icon("calendar"),
               menuSubItem(paste0("Sub Menu ", r())))
    )
  })
}
shinyApp(ui, server)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants