conditionalPanel在shinydashboard似乎无法工作?

问题描述 投票:0回答:1

ConditionalPanel 似乎无法使用 shinydashboardinput 变量的工作原理如图所示,但我就是无法关闭 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)

enter image description here

r shiny shinydashboard
1个回答
0
投票

经过几个小时的搜索,结果发现答案真的很直接。

condition = "input.chk ==1"

并解决了我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.