setFilter(uniqueName: String, filter: FilterObject)
[starting from version: 1.4]
Sets the filter for the specified hierarchy.
uniqueName
– String. The hierarchy’s unique name.filter
– FilterObject. It contains filtering information.filter.members
, filter.exclude
, and filter.include
filters do not apply if the hierarchy contains one member.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.