Filter components associate with a Refinement Lists component to specify how the filters will display and work.
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. |
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>