Skip to content

Commit

Permalink
Fixed labelRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLauer committed Feb 19, 2024
1 parent 2d24a69 commit b184b3f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
shinyWidgets 0.8.2
======================

* Fixed a bug where `virtualSelectInput()` did not register the `onServerSearch` parameter.
* Fixed a bug where `virtualSelectInput()` did not register the `onServerSearch` or `labelRenderer` parameters.

shinyWidgets 0.8.1
======================
Expand Down
10 changes: 5 additions & 5 deletions R/virtual-select.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ prepare_choices <- function(.data,
#' @param disableSelectAll Disable select all feature of multiple select.
#' @param disableOptionGroupCheckbox Disable option group title checkbox.
#' @param disabled Disable entire dropdown.
#' @param onServerSearch The character name of a function that should be called when searching. Note that the
#' function must be created outside of a $(document).ready() statement. For more information, see
#' [examples](https://sa-si-dev.github.io/virtual-select/#/examples?id=server-search).
#' @param ... Other arguments passed to JavaScript method, see
#' [virtual-select documentation](https://sa-si-dev.github.io/virtual-select/#/properties) for a full list of options.
#' @param stateInput Activate or deactivate the special input value `input$<inputId>_open` to know if the menu is opened or not, see details.
Expand All @@ -104,6 +101,11 @@ prepare_choices <- function(.data,
#' @note State of the menu (open or close) is accessible server-side through the input value:
#' `input$<inputId>_open`, which can be `TRUE` (opened) or `FALSE` (closed) or `NULL` (when initialized).
#'
#' @note For arguments that accept a function (`onServerSearch`, `labelRenderer`), only a string with a function name
#' is accepted. The function must be defined outside of any `$(document).ready({...})` javascript block. For examples, see the
#' documentation for [onServerSearch](https://sa-si-dev.github.io/virtual-select/#/examples?id=server-search)
#' and [labelRenderer](https://sa-si-dev.github.io/virtual-select/#/examples?id=add-imageicon).
#'
#' @seealso
#' * [demoVirtualSelect()] for demo apps
#' * [updateVirtualSelect()] for updating from server
Expand Down Expand Up @@ -131,7 +133,6 @@ virtualSelectInput <- function(inputId,
disableSelectAll = !multiple,
disableOptionGroupCheckbox = !multiple,
disabled = FALSE,
onServerSearch = NULL,
...,
stateInput = TRUE,
html = FALSE,
Expand All @@ -156,7 +157,6 @@ virtualSelectInput <- function(inputId,
disableSelectAll = disableSelectAll,
disableOptionGroupCheckbox = disableOptionGroupCheckbox,
disabled = disabled,
onServerSearch = onServerSearch,
...
))
)
Expand Down
5 changes: 4 additions & 1 deletion inst/packer/virtual-select.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions man/virtualSelectInput.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions srcjs/inputs/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ $.extend(virtualSelectBinding, {
if (config.onServerSearch) {
config.onServerSearch = window[config.onServerSearch];
}
if (config.labelRenderer) {
config.labelRenderer = window[config.labelRenderer];
}
config.ele = el;
VirtualSelect.init(config);
if (data.stateInput) {
Expand Down

0 comments on commit b184b3f

Please sign in to comment.