Skip to content

Commit

Permalink
Fixed onServerSearch bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLauer committed Feb 19, 2024
1 parent 3660e04 commit d02b2ea
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinyWidgets
Title: Custom Inputs Widgets for Shiny
Version: 0.8.1.9000
Version: 0.8.2.9000
Authors@R: c(
person("Victor", "Perrier", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Fanny", "Meyer", role = "aut"),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
shinyWidgets 0.8.2
======================

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

shinyWidgets 0.8.1
======================

Expand Down
5 changes: 5 additions & 0 deletions R/virtual-select.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ 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 Down Expand Up @@ -128,6 +131,7 @@ virtualSelectInput <- function(inputId,
disableSelectAll = !multiple,
disableOptionGroupCheckbox = !multiple,
disabled = FALSE,
onServerSearch = NULL,
...,
stateInput = TRUE,
html = FALSE,
Expand All @@ -152,6 +156,7 @@ virtualSelectInput <- function(inputId,
disableSelectAll = disableSelectAll,
disableOptionGroupCheckbox = disableOptionGroupCheckbox,
disabled = disabled,
onServerSearch = onServerSearch,
...
))
)
Expand Down
5 changes: 5 additions & 0 deletions man/virtualSelectInput.Rd

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

4 changes: 4 additions & 0 deletions srcjs/inputs/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ $.extend(virtualSelectBinding, {
data = JSON.parse(data.text);
var config = data.config;
config.options = makeOptions(data.options);
console.log(config.options);
if (config.onServerSearch) {
config.onServerSearch = window[config.onServerSearch];
}
config.ele = el;
VirtualSelect.init(config);
if (data.stateInput) {
Expand Down

0 comments on commit d02b2ea

Please sign in to comment.