Menu
Download Free Trial
Table of contents

setFilter

setFilter(hierarchyName:String, items:Array, negation:Boolean)

[starting from version: 1.4]

Sets the filter for the specified hierarchy.

Version: 1.7

One more property has been added – negation. If negation is false, setFilter() works the same as it works in previous versions, setFilter() tells the component to show the members of hierarchy specified in items. If negation is true, setFilter() tells the component to show all the members of hierarchy except the items. This allows for providing the shorter list of items when applying filter.

Parameters

  • hierarchyName – the name of the hierarchy
  • items – Array of hierarchy’s members to be reflected/shown according to the applied filter.
  • negation (optional) – It is false by default. It tells the component to show the members of hierarchy specified in items (true) or to show all the members of hierarchy except the items (false).

Examples

If you want to see data on ‘Cars’ and ‘Bikes’:

flexmonster.setFilter("Category", 
  [
    "category.[cars]", 
    "category.[bikes]"
  ]);

If you want to see all the categories except ‘Accessories’ now you can do this using the following code, where negation property is true:

flexmonster.setFilter("Category", 
  [
    "category.[accessories]"
  ], 
  true);

instead of

flexmonster.setFilter("Category", 
  [
    "category.[bikes]",
    "category.[cars]",
    "category.[clothing]",
    "category.[components]"
  ]);

See also

clearFilter
getFilter
setBottomX
setTopX