我对闪亮仪表板中的条件面板有疑问。是否有可能在 if(washerquestion){ // if washer == true or you can use else
your_function();
}
if(!washerquestion){ // if washer == false or you can use else
your_function();
}
的{{1}}条件中创建条件面板?我的目标是在点击菜单标签menuItem
后获得额外的sidebarMenu
(但selectInput
标签应保持隐藏状态。)
我正在做类似以下的事情
title2
在标准title1
中,可以通过将ui <- dashboardPage(
dashboardHeader(title = "Basic Dashboard"),
dashboardSidebar(
sidebarMenu(
menuItem("tab title1", tabName = "name1", icon = icon("th")),
menuItem("tab title2", tabName = "name2", icon = icon("th"))
),
conditionalPanel(
condition = "input.tabName == 'name2'",
selectInput("period", "Period:",
choices = list("Years" = 1, "Months" = 2))
)
),
dashboardBody())
添加到标签来完成,但此处不起作用。有谁知道任何解决方案?
在此先感谢:)
答案 0 :(得分:16)
向id
添加额外参数sidebarMenu
可以解决问题。
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())