-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selectInput multiple, ADD: replace/duplicate argument #518
Comments
You can use the "vanilla" select input, i.e.
Whenever selectize.js supports this feature, we will try to catch up. Thanks! |
Yihui, library(shiny)
runApp(list(
ui = bootstrapPage(
sidebarPanel(
selectInput("select1", "Select1:", c("A", "B", "C"), selectize = FALSE, multiple = TRUE)
),
mainPanel(
verbatimTextOutput("val")
)
),
server = function(input, output) {
output$val <- renderPrint(input$select1)
}
)) I would like to print: |
I see. I do not think that is possible unless you provide A, B, B, C as the choices. This comes from the limitation of the web browser/standard, and we cannot do much about it in shiny. Sorry. |
Selectize now enables duplicate entries. Can we have that feature in Shiny now |
It doesn't look to me like it is supported in selectize, fwiw. |
I also didn't see this anyhere in Selectize, but I did see the feature request in a couple places (selectize/selectize.js#129, selectize/selectize.js#1371) @debsush do you remember where you saw that it was supported by any chance? Anyway, I offer the following workaround, which relies on library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
uiOutput("selectContainer")
),
mainPanel(
verbatimTextOutput("val"),
actionButton("reset", "Reset")
)
)
)
server <- function(input, output, session) {
choices <- c("A", "B", "C")
chosen <- reactiveVal(c())
observeEvent(input$reset, chosen(c()))
output$selectContainer <- renderUI({
# Take a dependency on chosen to re-render when an option is selected.
chosen()
selectInput( "select1", "Select1:", choices, selectize = TRUE, multiple = TRUE)
})
observeEvent(input$select1, {
chosen(c(chosen(), input$select1))
})
output$val <- renderPrint(chosen())
}
shinyApp(ui, server) |
Hi,
Would be nice to allow multiple selections of the same item in the selectInput.
Consider we have
choices = c("field1","field2","field3","field4")
and we want to pass from this input to shinyServer a vector ofc("field1","field2","field2")
. Currently AFAIK you cannot do that.Regards,
Jan
The text was updated successfully, but these errors were encountered: