Overview
The sixth chapter explains the topic filter handling in custom widgets.
This chapter is recommended for anyone planning to create a custom widget that uses filter dependencies and can be filtered by other widgets.
The basis for chapter six is a custom widget that uses the data assignment as it was explained and created in chapter three.
Widget Preview
The custom widget “Demo widget 6” will display the data of columns and rows just like “Demo widget 3”, but additionally support the filtering of data.
The screenshots below show the final result of “Demo widget 6” being filtered by an other widget.
Resulting files
Demo widget 6 consists of the following directories and files.
As compared to the structure of "Demo widget 5" the following folders and files were added or changed.
\---customWidgets |
\--- demoWidget6 | demoWidget6Config.js | demoWidget6Module.js | +---assets | +---css | | widget_demoWidget6.less | | | \---images | demoWidget6MenuIcon_32x32.png | +---js | demoWidget6AssignDataCtrl.js | demoWidget6Ctrl.js | demoWidget6DataService.js | \---partials | demoWidget6.html | \--- assignDataDialog | advancedProperties.html | assignColumns.html | assignData.html | thresholdProperties.html | \--- columnTypeConfigTemplates date.html numeric.html text.html |
The created files and source code accompanying this article can be downloaded here.
Creation steps
Step 1: Enable the filter framework in custom widget configuration
In order to apply a filter on the data of a custom widget two preconditions must be fulfilled. One is the assigning of data and the other one is the activation of the filter framework for that widget.
For the second part please edit the custom widget configuration file demoWidget6Config.js and add the action "filter" as shown in the example below.
demoWidget6Config.js |
---|
|
Explanation: Adding the action "filter" in the custom widget configuration will enable the widget for using the filter framework.
If a custom widget meets all conditions for being filtered, the filter icon will be enabled in the widget properties menu. See screenshot below.
Pressing the filter icon will open the filter view where filter dependencies between widgets can be configured. A widget configured for filtering will offer all its available columns and inputs for the usage in a filter dependency.
This is handled by the filter framework and needs no further configuration or implementation. See screenshot below.
Summary and sources
As a final result of chapter six, the custom widget supports the filtering of data rows now.
Read in this series:
- (0) Custom widgets introduction and prerequisites
- (1) Creating a simple custom widget
- (2) Setting up data assignment
- (3) Configuration of assigned columns
- (4) Configuration of thresholds
- (5) Selection handling
- (5a) Multiple selection handling
- (6) Using filters
- (7) Creating actions
- (8) Enable multi-language support
- (9) Using the D3 library within a custom widget