【问题标题】:Shiny - submitButton and conditionalPanel [closed]闪亮 - submitButton 和 conditionalPanel [关闭]
【发布时间】:2015-05-26 04:08:38
【问题描述】:

我的 ul.R 上有很多条件面板,但是在添加提交按钮时它们没有像以前那样工作 - 在单击按钮之前 UI 不会自动更新(条件面板不会出现并消失为预计在点击提交之前),

shinyUI(fluidPage(

  headerPanel("Citizen Sense PM 2.5 Data Visualization Tool"),

  sidebarPanel(

    # Function options.
    radioButtons(
        inputId = "plot", 
        label = "Select a graph or a plot:", 
        choices = c(
            "Line Graph" = "line", 
            "Scatter Plot" = "scatter"
            ), 
        selected = NULL, 
        inline = FALSE
        ),

    # Condition for line graph. 
    conditionalPanel(
        condition = "input.plot == 'line'",
        radioButtons(inputId = "lineVariation", 
            label = "Choose a variation:", 
            choices = c(
                "Multiple" = "multiple", 
                "Single" = "single"
                ), 
            selected = NULL, 
            inline = FALSE)
        ),


    submitButton("Submit")

  ),
...

有什么想法我能做些什么吗?

【问题讨论】:

标签: r shiny


【解决方案1】:

要解决此问题,请执行以下操作:

  1. 关闭提交按钮并改用操作按钮。
  2. 使用 RenderUI 编写输出以在散点图时不显示任何内容或在线图时显示单选按钮。
  3. 修改上面的 #2,使其对 input$plot 的引用被隔离,并且仅在点击 #1 的操作按钮时更新。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-12
    • 2019-10-23
    • 2013-03-28
    • 1970-01-01
    • 2018-09-21
    • 2018-03-09
    • 2021-11-17
    • 2018-05-13
    相关资源
    最近更新 更多