Skip to contents

Use this with glassMultiSelect(..., server = TRUE) when the choice set is large. The browser sends search queries to Shiny and the server returns a bounded list of matching choices.

Usage

glassMultiSelectServer(
  inputId,
  choices,
  session = shiny::getDefaultReactiveDomain(),
  limit = 50L,
  ignore_case = TRUE
)

Arguments

inputId

Input id used in glassMultiSelect().

choices

Named or unnamed character vector of choices, or a named list for grouped choices (selectInput()-style). A one-element named list such as list(Group = "x") is treated as a flat, ungrouped choice, mirroring shiny::selectInput().

session

Shiny session. Defaults to the current reactive domain.

limit

Maximum number of matching choices returned per search. Default 50.

ignore_case

Logical. Match labels and values case-insensitively. Default TRUE.

Value

An observer created by shiny::observeEvent().

Examples

if (interactive()) {
  library(shiny)

  choices <- stats::setNames(
    sprintf("value-%04d", 1:1000),
    sprintf("Choice %04d", 1:1000)
  )

  ui <- fluidPage(
    useGlassTabs(),
    glassMultiSelect("pick", choices, server = TRUE)
  )

  server <- function(input, output, session) {
    glassMultiSelectServer("pick", choices, session = session)
  }

  shinyApp(ui, server)
}