Closed TymekDev closed 5 months ago
No response
The update_dropdown_input function is not capable of resetting a dropdown_input component back to its default value (if it had no initial selection).
update_dropdown_input
dropdown_input
Providing selected = "" or selected = character(0) to shiny::updateSelectInput clears the selection (if it had a placeholder provided).
selected = ""
selected = character(0)
shiny::updateSelectInput
library(shiny) library(shiny.semantic) ui <- semanticPage( dropdown_input("dropdown", LETTERS[1:5]), actionButton("clear", "Clear") ) server <- function(input, output, session) { try_clearing <- function(value) { print(value) before <- input$dropdown update_dropdown_input(session, "dropdown", value = NA) after <- input$dropdown print(paste("before:", before, "|", "after:", after)) } observeEvent(input$clear, { try_clearing(NA) try_clearing(NA_character_) try_clearing(NULL) try_clearing("") try_clearing(character(0)) }) } shinyApp(ui, server)
I expected the dropdown_input to be reverted to its original state: no value selected.
Guidelines
Project Version
No response
Platform and OS Version
No response
Existing Issues
No response
What happened?
The
update_dropdown_input
function is not capable of resetting adropdown_input
component back to its default value (if it had no initial selection).Providing
selected = ""
orselected = character(0)
toshiny::updateSelectInput
clears the selection (if it had a placeholder provided).Steps to reproduce
Steps
dropdown_input
without a default valueExample
Expected behavior
I expected the
dropdown_input
to be reverted to its original state: no value selected.Attachments
No response
Screenshots or Videos
No response
Additional Information
No response