`updateSelectControlInput` doesn't work correctly
Closed this issue · 2 comments
phoward38 commented
updateSelectControlInput
doesn't work as expected, specifically when:
choices = NULL
(i.e. keep the same choices)- removing and/or adding choices (& trying to select new choices)
Minimal Reprex:
library(shiny)
library(shinySelect)
ui <- fluidPage(
fluidRow(
column(
12,
shiny::actionButton(
"update",
"Update Select Control Input"
),
shinySelect::selectControlInput(
"test",
"Test",
choices = list("A", "B", "C"),
selected = c("A", "B"),
multiple = TRUE,
sortable = TRUE,
animated = TRUE,
closeMenuOnSelect = FALSE
)
)
)
)
server <- function(input, output, session) {
shiny::observeEvent(input$test, {
print(input$test)
})
shiny::observeEvent(input$update, {
shinySelect::updateSelectControlInput(
session,
"test",
choices = list(
"A",
"B",
"D"
),
selected = list(
"A",
"D"
)
)
})
}
shinyApp(ui, server)
stla commented
Thanks!
Indeed, the code was totally wrong. I've just pushed a new version for which your example works. I have not tested other examples yet.