Shiny: selectInput() is limited to 1000

Created on 6 Mar 2019  路  2Comments  路  Source: rstudio/shiny

selectize.min.js limits shiny::selectInput() to 1000. This can be really limiting to some applications. Maybe it would be possible to add a 'max' argument to shiny::selectInput() to allow more?

https://github.com/rstudio/shiny/blob/c79034649077f5fa6f8d615ce10c457eb33a2d2a/inst/www/shared/selectize/js/selectize.min.js

relevant: maxOptions:1e3

example:

if (interactive()) {
  shinyApp(
    ui = fluidPage(
      selectInput("example", "Example:",
                  1:1001
      ),
      textOutput("result")
    ),
    server = function(input, output) {
      output$result <- renderText({
        paste(input$example)
      })
    }
  )
}

Most helpful comment

Wow, yeah... I guess I forgot about shiny::selectizeInput() Thanks!

If anyone else comes across this, the solution is to set the argument maxOptions:

if (interactive()) {
  shinyApp(
    ui = fluidPage(
      selectizeInput("example", "Example:",options= list(maxOptions = 2000),
                  1:1001
      ),
      textOutput("result")
    ),
    server = function(input, output) {
      output$result <- renderText({
        paste(input$example)
      })
    }
  )
}

All 2 comments

Never realized shiny::selectInput() had such limits. You can always use shiny::selectizeInput(), which I'm pretty sure allows thousand of inputs. Moreover, it supports the server mode, which can boost the displaying speed quite well (see the server param of ?updateSelectizeInput).

Wow, yeah... I guess I forgot about shiny::selectizeInput() Thanks!

If anyone else comes across this, the solution is to set the argument maxOptions:

if (interactive()) {
  shinyApp(
    ui = fluidPage(
      selectizeInput("example", "Example:",options= list(maxOptions = 2000),
                  1:1001
      ),
      textOutput("result")
    ),
    server = function(input, output) {
      output$result <- renderText({
        paste(input$example)
      })
    }
  )
}
Was this page helpful?
0 / 5 - 0 ratings