For some reason, in 0.6.0, selected = TRUE in a menuItem() does not trigger the corresponding conditionalPanel(). (If you leave that out though, everything works fine - see example below).
No repro for < 0.6.0.
Repro
This works as expected:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(id = "tabs",
menuItem("tab1", tabName = "tab1"),
menuItem("tab2", tabName = "tab2")
),
conditionalPanel("input.tabs == 'tab1'",
"This does should appear on startup"
)
),
dashboardBody()
)
server <- function(input, output, session){}
shinyApp(ui, server)
This should result in exactly the same app, but it gets messed up:
From: https://stackoverflow.com/questions/44172064/shinydashboard-is-not-showing-item-properly-in-sidebar
For some reason, in 0.6.0,
selected = TRUE
in amenuItem()
does not trigger the correspondingconditionalPanel()
. (If you leave that out though, everything works fine - see example below).No repro for < 0.6.0.
Repro
This works as expected:
This should result in exactly the same app, but it gets messed up:
Workaround
Use a dynamic sidebar menu: