Conditional panel in Shiny dashboard

前端 未结 1 1938
渐次进展
渐次进展 2021-01-17 09:09

I have a question about conditional panel in shiny dashboard. Is there a possibility to make conditional panel with condition on menuItem in sidebarMenu

1条回答
  •  礼貌的吻别
    2021-01-17 09:15

    Adding an extra argument id to sidebarMenu solves the problem.

    ui <- dashboardPage(
    dashboardHeader(title = "Basic Dashboard"),
    dashboardSidebar(
        sidebarMenu(id="menu1",
            menuItem("tab title1", tabName = "name1", icon = icon("th")),
            menuItem("tab title2", tabName =  "name2", icon = icon("th"))
         ),
        conditionalPanel(
            condition = "input.menu1 == 'name2'",
            selectInput("period", "Period:", 
                        choices = list("Years" = 1, "Months" = 2))
        )
        ),
    dashboardBody())
    

    0 讨论(0)
提交回复
热议问题