bs4Dash
bs4Dash copied to clipboard
Dynamic sidebarMenu lost functionality
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)
}