From 3e557c7e707afb3dec5e01086a92e4a89a7f9691 Mon Sep 17 00:00:00 2001 From: DangerousWizardry <45795920+DangerousWizardry@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:51:37 +0200 Subject: [PATCH] bugfix: updateSelectInput handle correctly named list as choices Correct a bug where value is not correctly attributed to the data-value attribute in semantic selectInput when using named list as choices. --- R/dropdown.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/dropdown.R b/R/dropdown.R index 77a9d29a..4e35120c 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -247,9 +247,11 @@ updateSelectInput <- function(session, inputId, label = NULL, choices = NULL, se if (!is.null(selected)) selected <- paste(as.character(selected), collapse = ",") else selected <- NULL if (!is.null(choices)) { choices_text <- names(choices) + choices_value <- unlist(unname(choices)) if (identical(choices_text, NULL)) choices_text <- choices - options <- jsonlite::toJSON(list(values = data.frame(name = choices_text, text = choices_text, value = choices))) + + options <- jsonlite::toJSON(list(values = data.frame(name = choices_text, text = choices_text, value = choices_value))) } else { options <- NULL }