setFilter(hierarchyName: String, filter: Filter Object)
[starting from version: 1.4]
Sets the filter for the specified hierarchy.
Parameters
hierarchyName
– String. The name of the hierarchyfilter
– Filter Object. It contains filtering information.Examples
1) If you want to see data on ‘Cars’ and ‘Bikes’:
flexmonster.setFilter("Category", { "members": [ "category.[bikes]", "category.[cars]" ] } );
Try the example on JSFiddle.
2) If you want to see all the categories except ‘Accessories’ now you can do this using the following code, where exclude
property is used:
flexmonster.setFilter("Category", { "exclude": [ "category.[accessories]" ] } );
instead of
flexmonster.setFilter("Category", { "members": [ "category.[bikes]", "category.[cars]", "category.[clothing]", "category.[components]" ] } );
Check out on JSFiddle.
See also