Get Free Trial
API reference
Table of contents

setFilter

setFilter(uniqueName: String, filter: FilterObject)

[starting from version: 1.4]

Sets the filter for the specified hierarchy.

Parameters

  • uniqueName – String. The hierarchy’s unique name.
  • filterFilterObject. It contains filtering information.
    Note that filter.members, filter.exclude, and filter.include filters do not apply if the hierarchy contains one member.

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

clearFilter
getFilter