我正在编写一个闪亮的应用程序,并希望使用selectizeInput。不幸的是,选择的数量巨大(> 250,000),导致该应用在启动时崩溃。因此,我有兴趣解决这个问题。 我想到的一种方式是自动完成àGoogle搜索。是否有一个小工具或类似的东西可以解决我的问题?如果可能的话,我不想使用“预过滤器”。 非常感谢!
答案 0 :(得分:0)
如果通过选项maxOptions
限制选项的数量,是否可以解决问题?
library(shiny)
shinyApp(
ui = fluidPage(
selectizeInput("variable", "Variable:",
c("Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear"),
options=list(maxOptions=2)
),
tableOutput("data")
),
server = function(input, output) {
output$data <- renderTable({
mtcars[, c("mpg", input$variable), drop = FALSE]
}, rownames = TRUE)
}
)
答案 1 :(得分:0)
我找到了解决我问题的方法:可以从服务器端填充selectizeInput。因此,在加载ui时,该框不会随着条目“爆炸”。 -> Shiny.rstudio.com/articles/selectize.html