sideFilterUI: Create a switchable filter input component

View source: R/sideFilterUI.R

sideFilterUIR Documentation

Create a switchable filter input component

Description

Create an input component intended to function as a filter that can be turned on/off

Usage

sideFilterUI(
  inputId,
  values,
  input = c("select", "selectize", "checkbox", "checkboxGroup", "range"),
  selected = NULL,
  conditional = NULL,
  ns = NS(NULL),
  width = 200
)

Arguments

inputId

The input slot that will be used to access the value.

values

Choices for the input.

input

One of input types c("select", "selectize", "checkbox", "checkboxGroup", "range"), corresponding to selectInput, selectizeInput, checkboxInput, checkboxGroupInput, or sliderInput (range).

selected

The initial selection of the input, which defaults to "first" for the first of values, but can also be specified as "last", "all" or "none".

conditional

If given a boolean value, will wrap element in a conditional panel with inital display given by the value, with a switch element to control conditional display. Use NULL to render component without conditional control.

ns

Function for namespacing components, i.e. from 'session$ns'.

width

Width of input elements.

Details

This is a wrapper for creating certain Shiny input components to use as dataset filters, e.g. each column of a table gets its own specified input component, which is of a type enumerated in the parameter type. Generally, sliderInput (range) is appropriate for numeric columns representing continuous data, while selectInput, selectizeInput and checkboxInput can be used for discrete data, and checkboxGroupInput can be used for list columns (especially if using data.table).

Whether to initialize the input with none or all of the available values selected will depend on the data. For a very big table, it makes the most sense to initialize inputs with a selection of values that show the most relevant filtered subset rather than everything.

The inputs have namespaced IDs "<namespace>-filter-<colname>" by applying the passed-in namespacing function ns to id. To get values in a server function, use filter4j.


avucoh/DIVE documentation built on Aug. 29, 2023, 6:02 p.m.