我有一个关于我的Shiny应用程序的问题。目标是在用户按下actionButton时禁用应用程序中的某些输入。我找到了this解决方案,对于文本输入和数字输入有效,但对于selectinput或selectizeinput却奇怪地无效。我知道该解决方案包含一些使用JavaScript的内容,但我不知道如何操作。
感谢您的帮助!
编辑:
也许我没有表述清楚。抱歉!我将添加必要的代码块。
这是来自链接的disablefunction。它可以很好地与actionButtons和numeric Inputs配合使用,但不能与select或selectize Input配合使用。
这是未被禁用的输入示例。正如我所说,解决方案可能在JavaScript中,但说实话,我甚至不了解基础知识。我尝试过不同的问题,比如hide=true或select=false,但都没有起作用(你也可以看到上面没有起作用的函数)。
感谢您的帮助!
编辑:
也许我没有表述清楚。抱歉!我将添加必要的代码块。
这是来自链接的disablefunction。它可以很好地与actionButtons和numeric Inputs配合使用,但不能与select或selectize Input配合使用。
disableActionButton <- function(id,session) {
session$sendCustomMessage(type="jsCode",
list(code= paste("$('#",id,"').prop('disabled',true)"
,sep="")))
disableselectButton <- function(id,session) {
session$sendCustomMessage(type="jsCode",
list(code= paste("$('#",id,"').prop('select',false)"
,sep="")))
disableselectButton <- function(id,session) {
session$sendCustomMessage(type="jsCode",
list(code= paste("$('#",id,"').prop('hide',false)"
,sep="")))
这是未被禁用的输入示例。正如我所说,解决方案可能在JavaScript中,但说实话,我甚至不了解基础知识。我尝试过不同的问题,比如hide=true或select=false,但都没有起作用(你也可以看到上面没有起作用的函数)。
selectInput("algorithmicMethod1",
label=h5("Berechnungsalgorithmus erster Wahl"),
c("RoT","Pickands"),
selected="RoT"),
conditionalPanel(condition="input.algorithmicMethod1 =='RoT'",
selectInput("algorithmicMethod2",
label=h5("Berechnungsalgorithmus zweiter Wahl"),
"Pickands",
selected="Pickands")),
conditionalPanel(condition="input.algorithmicMethod1 =='Pickands'",
selectInput("algorithmicMethod2",
label=h5("Berechnungsalgorithmus zweiter Wahl"),
"RoT",
selected="RoT"))
那么,有没有其他方法可以禁用select/selectize-Inputs?
再次感谢。:)