Simple Filter Pickers
Last updated
Last updated
The popup filters in use by the filter toolbar can also be used as stand-alone simple filters and pickers. The scope svyPopupFilter provides UX patterns with a variety of PopUp/Dialog pickers such as dates range picker, number range picker and multi-select picker.
The module provides out-of-the-box implementation templates for the PopUp/Dialog pickers, but is also extensible to allow for other UI types and templates.
The simple filters are meant to be used as pickers for filtering whether the toolbar filter is not a viable approach; while the toolbar filter is great used in conjunction with the NG Grid, there can be several scenario where an NG Grid cannot be used to configure your filters toolbar; you would still like to use advanced filtering pattern, a common use case is to filter data in charts or in other grid types then the NG Grid. Other possible use cases for the simple filters are stand-alone pickers to be used in the logic of your form (.e.g pick arrival and return date of a route).
Pick a range of dates between, before or after the selected date/s; it returns respectively the selected value/s as:
[dateFrom, dateTo]
[beforeDate]
[afterDate]
Pick a range of Number between, smaller or greater than the selected value/s; it returns respectively the selected value/s as:
[minValue, maxValue]
[maxValue]
[minValue]
Pick a list of free-text tokens; the entered tokens are returned as an array of String values,
Pick a list of multiple options; the selected values are returned as an array. The Multi Select picker is based on the svyLookup module.
Pick an option between "Yes" and "No"; the selected value is returned as 1 or 0.
It takes just a few lines of code to configure and show a stand-alone filter picker. The selected values and operator can be handled in a callback. There are 4 types of filter picker: DateFilter, NumberFilter, TokenFilter and SelectFilter.
Show Filter Picker
Handle selection in callback
The selected values and the selected operator are returned in the selection callback respectively as an Array and as a String which is one of scopes.svyPopupFilter.OPERATOR enum values.
The Select filter type constructor requires a svyLookup object and a dataprovider which will be used as Lookup DataProvider. Rather than providing a new implementation for a single or multi-select pattern the SelectFilter type wraps the Lookup object in th SvySelectFilter object;
Any filter picker can be shown as a PopUp, Modal and Non-Modal Window; PopUp and Window can be customized to best suit your experience.
Show as Default Popup
Show as Custom PopUp
Show as Default Modal Dialog
Show as Custom Dialog
Is it possible to set and get the filter selection for it's values and operator programmatically; the operator can be one of the values of the scopes.svyPopupFilter.OPERATOR enum; note that some operators may not be applicable for certain filter types. For example the Token filter type support only the operator scopes.svyPopupFilter.OPERATOR.IS_IN.
The state of every single filter picker can be persisted into a serializable JSON object and can be restored any moment using the filter object API.
Optionally custom parameters can be added to the filter picker object; custom parameters can be retrieved in the selection callback from the filter argument. Note that custom parameters do not have any effect to the picker itself, are simply used to pass additional information to the selection callback.
The module provides out-of-the-box implementation templates for the PopUp/Dialog pickers, but is also extensible to allow for other UI types and templates. Every template offers a custom implementation as a Servoy Form extending one of the Abstract forms (depending from the filter type).
The template to be used by filter object can be set with the method setRendererForm.
You can learn more on custom templates in the dedicated wiki section.