闪亮 - submitButton 和 conditionalPanel
Shiny - submitButton and conditionalPanel
我的 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")
),
...
有什么想法可以解决吗?
要解决此问题,请执行以下操作:
- 关闭提交按钮并改用操作按钮。
- 使用 RenderUI 编写输出以在散点图时不显示任何内容或在线图时显示单选按钮。
- 修改上面的 #2,使其对 input$plot 的引用被隔离,并且仅在点击 #1 中的操作按钮时更新。
我的 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")
),
...
有什么想法可以解决吗?
要解决此问题,请执行以下操作:
- 关闭提交按钮并改用操作按钮。
- 使用 RenderUI 编写输出以在散点图时不显示任何内容或在线图时显示单选按钮。
- 修改上面的 #2,使其对 input$plot 的引用被隔离,并且仅在点击 #1 中的操作按钮时更新。