我需要在我的界面中有多个标签,并且在每个标签中我都想使用conditionalPanel.正如您将在下面看到的可重现代码所示,conditionalPanel在第一个选项卡中工作,但在其他选项卡中不工作.
ui <- pageWithSidebar(
headerPanel("Hello !"),
sidebarPanel(
tabsetPanel(
tabPanel("a",
textInput(inputId = "A1", label = "1:", value = "A1"),
checkboxInput(inputId = "new_A2",
label = "Add another one",
value = FALSE),
conditionalPanel(
condition = "input.new_A2 == true",
textInput(inputId = "A2", label = "2:", value = "A2")
)),
tabPanel("b",
textInput(inputId = "B1", label = "1:", value = "C1"),
checkboxInput(inputId = "new_B2",
label = "Add another one",
value = FALSE),
conditionalPanel(
condition = "input.new_B2 == true",
textInput(inputId = "B2", label = "2:", value = "C2")
)
)
)
),
mainPanel()
)
server <- function(input,output){
}
runApp(list(ui=ui,server=server))
Run Code Online (Sandbox Code Playgroud)
我知道有很多与conditionalPanel有关的问题,但我还没有找到答案.
提前感谢您,任何建议都非常感谢
例如tabsetPanel(id="tabs",为tabset面板指定id,并在选项卡"b"聚焦时添加条件input.tabs == 'b'
例如,在您的第二个条件面板中,条件是:
condition = "input.tabs == 'b' & input.new_B2 == true"