mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-11 07:58:11 -05:00
Compare commits
1 Commits
v1.7.0
...
barbara/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff034c5013 |
@@ -557,12 +557,13 @@ updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' }
|
||||
#' @export
|
||||
updateSelectInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
selected = NULL) {
|
||||
selected = NULL, multiple = NULL) {
|
||||
choices <- if (!is.null(choices)) choicesWithNames(choices)
|
||||
if (!is.null(selected))
|
||||
selected <- validateSelected(selected, choices, inputId)
|
||||
options <- if (!is.null(choices)) selectOptions(choices, selected)
|
||||
message <- dropNulls(list(label = label, options = options, value = selected))
|
||||
message <- dropNulls(list(label = label, options = options,
|
||||
value = selected, multiple = multiple))
|
||||
session$sendInputMessage(inputId, message)
|
||||
}
|
||||
|
||||
@@ -574,8 +575,8 @@ updateSelectInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' version of \pkg{selectize.js})
|
||||
#' @export
|
||||
updateSelectizeInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
selected = NULL, options = list(),
|
||||
server = FALSE) {
|
||||
selected = NULL, multiple = NULL,
|
||||
options = list(), server = FALSE) {
|
||||
if (length(options)) {
|
||||
res <- checkAsIs(options)
|
||||
cfg <- tags$script(
|
||||
@@ -587,7 +588,7 @@ updateSelectizeInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
session$sendInputMessage(inputId, list(config = as.character(cfg)))
|
||||
}
|
||||
if (!server) {
|
||||
return(updateSelectInput(session, inputId, label, choices, selected))
|
||||
return(updateSelectInput(session, inputId, label, choices, selected, multiple))
|
||||
}
|
||||
value <- unname(selected)
|
||||
attr(choices, 'selected_value') <- value
|
||||
|
||||
@@ -4117,6 +4117,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
||||
this.setValue(el, data.value);
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('multiple')) {
|
||||
if (data.multiple) {
|
||||
$(el).attr('multiple', 'multiple');
|
||||
$(el).next().attr('class', 'selectize-control multi');
|
||||
} else {
|
||||
$(el).attr('multiple', '');
|
||||
$(el).next().attr('class', 'selectize-control single');
|
||||
}
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('label')) $(el).parent().parent().find('label[for="' + $escape(el.id) + '"]').text(data.label);
|
||||
|
||||
$(el).trigger('change');
|
||||
@@ -5184,4 +5194,4 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
||||
})();
|
||||
|
||||
//# sourceMappingURL=shiny.js.map
|
||||
//# sourceMappingURL=shiny.js.map
|
||||
//# sourceMappingURL=shiny.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
inst/www/shared/shiny.min.js
vendored
6
inst/www/shared/shiny.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -87,6 +87,17 @@ $.extend(selectInputBinding, {
|
||||
this.setValue(el, data.value);
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('multiple')) {
|
||||
if (data.multiple) {
|
||||
$(el).attr('multiple', 'multiple');
|
||||
$(el).next().attr('class', 'selectize-control multi');
|
||||
}
|
||||
else {
|
||||
$(el).attr('multiple', '');
|
||||
$(el).next().attr('class', 'selectize-control single');
|
||||
}
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('label'))
|
||||
$(el).parent().parent().find('label[for="' + $escape(el.id) + '"]').text(data.label);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user