【发布时间】:2015-06-14 16:02:33
【问题描述】:
假设我有以下闪亮的应用程序:
library(shiny)
ui <- fluidPage(
column(3,
radioButtons("radios", "",
c("Enabled" = "enabled",
"Disabled" = "disabled"),
inline = TRUE)
),
column(4, textInput("text", "", value = "Disable me"))
)
server <- function(input, output) {
}
shinyApp(ui=ui, server=server)
根据所选单选按钮禁用textInput 的最简单方法是什么?我知道我只需要将 ... disabled /> 添加到 input 标签,但我不知道如何在 Shiny 中做到这一点。
我尝试使用uiOutput 和renderUI(基于this)将HTML 作为字符串、选定的单选值和HTML 的其余部分粘贴为字符串“手动”构建完整标签,但这并没有不行。
textInput 生成这个:
<input id="text" type="text" class="form-control" value="Disable me"/>
我需要能够在上面和这个之间切换:
<input id="text" type="text" class="form-control" value="Disable me" disabled />
【问题讨论】: