条件面板中的javascript条件:javascript中%运算符中是否存在R%?

我正在尝试使用闪亮包中的conditionalPanel函数构建一个闪亮的应用程序.条件应该用 JavaScript编写,但我希望能够使用如下条件(用R编写)
"TP53" %in% unlist(input$ModelVariables)

文件说明:

condition –
A JavaScript expression that will be evaluated repeatedly to determine whether the panel should be displayed.

我根本不熟悉JavaScript.我尝试过input.ModelVariables ==’TP53’但是当input.ModelVariables的长度大于1时,这不起作用.

我的sidebarPanel片段与conditionalPanel在下面

checkBoxGroupInput("ModelVariables",label = h3("Which variables to view?"),choices = list( "cohort","stage","therapy","TP53","MDM2" ),selected = list("TP53")
                                  ),conditionalPanel(condition = "'TP53' in unlist(input.ModelVariables)",checkBoxGroupInput("ModelVariablesTP53",label = h3("Which mutations to view?"),choices = list( "Missense","Other","WILD"),selected = list("Missense","WILD")
                                                        )

解决方法

根据 this answer这个条件应该工作(它适用于我)

condition =“input.ModelVariables.indexOf(‘TP53’)> -1”

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...