【发布时间】:2018-06-08 19:26:08
【问题描述】:
我正在开发一个基本的 Shiny UI 模板,用户必须选择某个按钮才能给应用程序输入。现在我正在使用 conditionalPanel() 但不是输入按钮完全消失,是否可以将它们变灰?
下面是代码:
library(shiny)
library(shinyjs)
ui<-fluidPage(
headerPanel("Title"),
sidebarPanel(
radioButtons("toggle", "Some Buttons",
choices = list("Choice 1" = 1,
"Choice 2" = 2),
selected = "Choice 2")),
conditionalPanel(
condition = "input.toggle % 2 == 0",
sidebarPanel(radioButtons("otherButtons","Buttons",
choices = list("Choice 1"=1,
"Choice 2"=2)),
radioButtons("moreButtons","Buttons",
choices = list("Choice 1"= 1,
"Choice 2" = 2))
),
"Some Text"
)
)
server<-function(input,output,session){
}
shinyApp(ui,server)
【问题讨论】:
-
也许library(shinyjs)可以帮助你?