Can*_*ice 7 performance r shiny selectize.js
在 RShiny 应用程序中,我收到警告消息Warning message: The select input "the_input_id" contains a large number of options; consider using server-side selectize for massively improved performance. See the Details section of the ?selectizeInput help topic.
我有一个长度 == 3000 的命名向量名单,用于下拉选项。我尝试了以下两种方法来消除此警告:
用户界面
selectizeInput(
inputId = 'the_input_id', label = 'Player 1 Search:', choices = namelist, selected = NULL,
options = list(placeholder = 'Please select an option below', onInitialize = I('function() { this.setValue(""); }'))
)
uiOutput(outputId = 'this_id')
Run Code Online (Sandbox Code Playgroud)
服务器
updateSelectizeInput(session = session, inputId = 'the_input_id', label = 'Player 1 Search:', choices = namelist, server = TRUE,
options = list(placeholder = 'Please select an option below', onInitialize = I('function() { this.setValue(""); }')),
selected = ""
)
output$this_id<-renderUI ({
selectizeInput(inputId = 'this_id', "Player 2 Search:", namelist,
options = list(
placeholder = 'Please select an option below',
onInitialize = I('function() { this.setValue(""); }')
))
})
Run Code Online (Sandbox Code Playgroud)
the_input_id的方法是在 UI 中使用 selectizeInput() ,在服务器中使用 updateSelectizeInput() (我认为这是服务器端 selectize 的正确方法)。this_id的方法是在 UI 中使用 uiOutput(),在服务器上使用 renderUI + selectizeInput。这两种方法都会给出与我上面发布的相同的警告消息。我怎样才能解决这个问题/摆脱这个警告消息。