Developers

Filter Components

Create a filter component

Filter components associate with a Refinement Lists component to specify how the filters will display and work.

Usage

sdk.filterComponent(filterType: String, filterOptions: Object = {});
Parameter Type Description
filterType String The filter component name. You can write it in kebab-case or CamelCase. See below for a list of available components.
filterOptions Object The component options. See the options available for each component.

Available components

Example of component creation with options.

Basic example using the results component Store, through the linkTo method:
<div id="colour-filters"></div>
<div id="results"></div>

<script>
  var results = sdk.component('results', '#results');
  var colorRefinement = sdk.filterComponent('facet', { attributeName: 'COLOUR'});
  var colorFilter = sdk.component('refinement-lists', '#colour-filters', {
    refinements: [
      { component: colorRefinement, headerText: 'Colour filter' }
    ]
  });
  results.linkTo(colorFilter);
</script>