ConditionalPanel
似乎无法使用 shinydashboard
的 input
变量的工作原理如图所示,但我就是无法关闭 slideInput
根据 conditionalPanel
块。
我觉得挺奇怪的,请指教.这是我的上例。
library(shiny)
library(shinydashboard)
ui <-
dashboardPage(
dashboardHeader(title = ""),
dashboardSidebar(
checkboxInput("chk", label = "checkBox",value = FALSE ),
conditionalPanel(condition = "input.chk ==TRUE",
sliderInput("slide", label = "test", min = 0, max = 10, value = 5))
),
dashboardBody(
textOutput("result"),
textOutput("checked")
)
)
server <-
function(input, output, session) {
result <- reactive(ifelse(input$slide >5, " greater than 5", "smaller than 5"))
output$result <- renderText(result())
output$checked <- renderText(input$chk)
}
shinyApp(ui, server)
经过几个小时的搜索,结果发现答案真的很直接。
condition = "input.chk ==1"
并解决了我的问题。