In my application the user has possibility to chose "simple" FilterEditor or "advanced" AdvancedFilter and switch between them.
The transition from simple to advanced filter works without problems.
Transition from advanced to simple filter is problematic: it is obvious that simple filter doesn't support all possibilities of advanced filter, so the simple filter doesn't work after the switch.
I decided to empty the criteria when switching from advanced to simple filter, but this doesn't work either: even when setting an empty criteria by calling ListGrid.setCriteria({}) the criteria type remains AdvancedCriteria, which is not supported by simple filter.
Workaround for this problem is to explicitely set the ListGrid.data.criteria variable to null or remove it:
but I think that this is not the "official" way since the manual for ResultSet.criteria says: "Use ResultSet.setCriteria() to change the criteria after initialization."
The proper solution would be:
- setting empty criteria with setCriteria() should always change the criteria type to simple criteria
or/and
- implement a function "unconvertCriteria" (the opposite of convertCriteria), which try to convert advanced criteria back to simple criteria and returns a flag if the conversion was successful or not.
The transition from simple to advanced filter works without problems.
Transition from advanced to simple filter is problematic: it is obvious that simple filter doesn't support all possibilities of advanced filter, so the simple filter doesn't work after the switch.
I decided to empty the criteria when switching from advanced to simple filter, but this doesn't work either: even when setting an empty criteria by calling ListGrid.setCriteria({}) the criteria type remains AdvancedCriteria, which is not supported by simple filter.
Workaround for this problem is to explicitely set the ListGrid.data.criteria variable to null or remove it:
Code:
delete ListGrid.data.criteria; ListGrid.setCriteria();
The proper solution would be:
- setting empty criteria with setCriteria() should always change the criteria type to simple criteria
or/and
- implement a function "unconvertCriteria" (the opposite of convertCriteria), which try to convert advanced criteria back to simple criteria and returns a flag if the conversion was successful or not.
Comment