【问题标题】:Button value as a condition of conditionalpanel in shiny按钮值作为闪亮条件面板的条件
【发布时间】:2017-11-12 01:58:02
【问题描述】:

我有一个表单,一旦完成,就会有一个“完成”按钮。一旦用户单击“完成”按钮,我想显示一个闪亮的仪表板而不是表单。

为此,我想到了两个条件面板,因为一个按钮有一个值,如果这个值为 0,则显示表单,否则显示闪亮仪表板。我的问题是条件不起作用。

整个代码太大而无法重现,所以主要思想是这样的:

#server.R

library(shiny)

shinyServer(function(input, output) {

  output$frontEnd <- renderUI(
    fluidPage(
      input$buton,
      conditionalPanel("input$buton == 0",p("I'm a form")),
      conditionalPanel("input$buton > 0", p("I'm a dashboard"))
    )
  )
})



#UI.r
library(shiny)

shinyUI(fluidPage(

  # Application title
  actionButton("buton","click me"),
  htmlOutput("frontEnd")
))

知道为什么不取按钮的值吗?

【问题讨论】:

    标签: r shiny shiny-reactivity


    【解决方案1】:

    试试:

    conditionalPanel(condition = "input.buton == 0", p("I'm a form")),
    conditionalPanel(condition = "input.buton > 0", p("I'm a dashboard"))
    

    条件参数是javascript expression

    【讨论】:

      猜你喜欢
      • 2016-09-24
      • 2017-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-06
      • 2014-03-03
      • 2016-06-30
      • 2016-04-10
      相关资源
      最近更新 更多