queryBuilderInput {jqbr} | R Documentation |
queryBuilderInput
Description
Shiny input bindings for queryBuilder.
Usage
queryBuilderInput(
inputId,
width = "100%",
filters,
plugins = NULL,
rules = NULL,
optgroups = NULL,
default_filter = NULL,
sort_filters = FALSE,
allow_groups = TRUE,
allow_empty = FALSE,
display_errors = FALSE,
conditions = c("AND", "OR"),
default_condition = "AND",
inputs_separator = ",",
display_empty_filter = TRUE,
select_placeholder = "------",
operators = NULL,
add_na_filter = FALSE,
return_value = c("r_rules", "rules", "sql", "all")
)
Arguments
inputId |
string. Input id for the builder. |
width |
Width of the builder. Default if "100%". |
filters |
list of list specifying the available filters in the builder. See example for a See https://querybuilder.js.org/#filters for details on the possible options |
plugins |
list of optional plugins. |
rules |
Initial set of rules. By default the builder will contain one empty rule |
optgroups |
List of groups in the filters and operators dropdowns. |
default_filter |
string. The |
sort_filters |
boolean \| string. Sort filters alphabetically, or with a custom JS function. |
allow_groups |
boolean \| integer. Number of allowed nested groups.
|
allow_empty |
boolean. If |
display_errors |
boolean. If |
conditions |
string. Array of available group conditions. Use the
|
default_condition |
Default active condition. Default 'AND'. |
inputs_separator |
string used to separate multiple inputs (for between operator). default is ",". |
display_empty_filter |
boolean. Default |
select_placeholder |
string. Label of the "no filter" option. |
operators |
NULL or list. If a list, format should follow that described here: https://querybuilder.js.org/#operators |
add_na_filter |
bool. Default is FALSE .If |
return_value |
string. On of |
Value
A htmltools::tagList()
containing the queryBuilder
dependencies and configuration that can be added to a shiny UI definition.
Examples
library(shiny)
library(jqbr)
ui <- fluidPage(
useQueryBuilder(),
queryBuilderInput(
inputId = "qb",
filters = list(
list(
id = "name",
type = "string"
)
)
)
)
server <- function(input, output) {
observeEvent(input$qb, {
print(input$qb)
})
}
# Add is_na filter
ui <- fluidPage(
useQueryBuilder(),
queryBuilderInput(
inputId = "qb",
add_na_filter = TRUE,
return_value = "r_rules",
filters = list(
list(
id = "name",
type = "string"
)
)
)
)
server <- function(input, output) {
observeEvent(input$qb, {
print(input$qb)
})
}
if (interactive()) {
shinyApp(ui, server)
}