更新selecInput并在Shiny中包含1,000多个项目

时间:2018-09-07 18:39:13

标签: r user-interface shiny shiny-server shiny-reactivity

我想用超过1,000个项目更新Shiny应用程序上的selectInput项目,但显然不接受超过1,000个项目。

有没有一种方法可以在用户开始输入内容时添加更多值或从服务器加载它?服务器参数也不起作用。

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(
  tags$head(tags$script(src = "message-handler.js")),

   # Application title
   titlePanel("Large selectInput"),

   # Sidebar with a slider input for number of bins 
   sidebarLayout(
      sidebarPanel(
         selectInput("Names",
                     "List of Names",
                     choices = c("A")
                     )
      ),
      mainPanel("Empty")
   )
)

# Define server logic required to draw a histogram
server <- function(input, output, session) {
  names <- 1:5000
  observe({
    updateSelectInput(session, "Names", label = "Updated", choices = names, server = TRUE)
  })
  }
# Run the application 
shinyApp(ui = ui, server = server)

1 个答案:

答案 0 :(得分:0)

selectizeInput()可以处理1000多个记录。