apply checkAsIs() to selectizeInput(), and store the names in data-eval in the script

note we switched the order of {} and config.text() in $.extend(), so that users can overwrite the default options like labelField, valueField, ...
This commit is contained in:
Yihui Xie
2014-02-18 00:54:06 -06:00
parent 16279695a9
commit 29701d7295
2 changed files with 15 additions and 4 deletions

View File

@@ -740,6 +740,8 @@ selectInput <- function(inputId,
#' \url{https://github.com/brianreavis/selectize.js} for possible options
#' @export
selectizeInput <- function(inputId, ..., options = NULL) {
res <- checkAsIs(options)
tagList(
selectInput(inputId, ...),
singleton(tags$head(
@@ -749,7 +751,8 @@ selectizeInput <- function(inputId, ..., options = NULL) {
)),
tags$script(
type = 'application/json', `data-for` = inputId,
if (length(options)) toJSON(options) else '{}'
`data-eval` = if (length(res$eval)) HTML(toJSON(res$eval)),
if (length(res$options)) HTML(toJSON(res$options)) else '{}'
)
)
}