module_filter_manager {teal} | R Documentation |
Manage multiple FilteredData
objects
Description
Oversee filter states across the entire application.
Usage
ui_filter_manager_panel(id)
srv_filter_manager_panel(id, slices_global)
ui_filter_manager(id)
srv_filter_manager(id, slices_global)
srv_module_filter_manager(id, module_fd, slices_global)
Arguments
id |
( |
slices_global |
( |
module_fd |
( |
Value
Module returns a slices_global
(reactiveVal
) containing a teal_slices
object with mapping.
Slices global
The key role in maintaining the module-specific filter states is played by the .slicesGlobal
object. It is a reference class that holds the following fields:
-
all_slices
(reactiveVal
) - reactive value containing all filters registered in an app. -
module_slices_api
(reactiveValues
) - reactive field containing references to each modules'FilteredData
object methods. At this moment it is used only insrv_filter_manager
to display the filter states in a table combining informations fromall_slices
and fromFilteredData$get_available_teal_slices()
.
During a session only new filters are added to all_slices
unless module_snapshot_manager
is
used to restore previous state. Filters from all_slices
can be activated or deactivated in a
module which is linked (both ways) by attr(, "mapping")
so that:
If module's filter is added or removed in its
FilteredData
object, this information is passed toSlicesGlobal
which updatesattr(, "mapping")
accordingly.When mapping changes in a
SlicesGlobal
, filters are set or removed from module'sFilteredData
.
Filter manager
Filter-manager is split into two parts:
-
ui/srv_filter_manager_panel
- Called once for the whole app. This module observes changes in the filters inslices_global
and displays them in a table utilizing information frommapping
:
(
TRUE
) - filter is active in the module(
FALSE
) - filter is inactive in the module(
NA
) - filter is not available in the module
-
ui/srv_module_filter_manager
- Called once for eachteal_module
. Handling filter states for of single module and keeping moduleFilteredData
consistent withslices_global
, so that local filters are always reflected in theslices_global
and its mapping and vice versa.