简体   繁体   English

条件面板似乎不能在闪亮仪表板上工作?

[英]conditionalPanel seems not working at shinydashboard?

ConditionalPanel seems not working with shinydashboard the input variables are working as shown, but I just can't turn off the slideInput under the conditionalPanel chunk. ConditionalPanel似乎无法与shinydashboard一起使用, input变量如图所示,但我无法关闭conditionalPanel块下的slideInput

quite odd to me, please advise.对我来说很奇怪,请指教。 Here is my top example这是我的最佳示例

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)

在此处输入图像描述

After few hours of searching, the answer turned out to be really straightforeward.经过几个小时的搜索,结果证明是非常直截了当的。

condition = "input.chk ==1"

and solved my question.并解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM