Filter Cloud
`ff-filter-cloud` lists filters applied to the current results. It lets users remove filters and supports custom templates, ordering, and facet inclusion rules.
Documentation
Filter Cloud displays all filters that are currently selected. In its templates, it provides the related Facet and the selected FacetElement.
Specifying templates
Rendered HTML
When set up like in the example above, the rendered HTML could look like this:
<ff-filter-cloud>
<span data-template="filter">Element 1</span>
<span data-template="filter">Element 2</span>
<span data-template="filter">Element 3</span>
<span data-template="filter">Element 4</span>
</ff-filter-cloud>Customize filter element appearance
To customize filter element appearance, you can add an HTML element annotated with data-template="filter". You can access the facet's display name through {{facet.name}}:
<ff-filter-cloud>
<span data-template="filter">{{facet.name}}: {{element.text}}</span>
</ff-filter-cloud>Rendered HTML
When set up like in the example above, the rendered HTML could look like this:
<ff-filter-cloud>
<span data-template="filter">Group 1: Element 1</span>
<span data-template="filter">Group 2: Element 2</span>
<span data-template="filter">Group 3: Element 3</span>
<span data-template="filter">Group 4: Element 4</span>
</ff-filter-cloud>Add custom HTML
A custom filter template can be used with some additional custom HTML.
<ff-filter-cloud>
<h4>The Filter Cloud</h4>
<div>
<div>Custom above</div>
<div data-template="filter" class="filter-element">
<span>{{facet.name}}: {{element.text}}</span><span> ×</span>
</div>
<div>Custom below</div>
</div>
</ff-filter-cloud>Rendered HTML
When set up like in the example above, the rendered HTML could look like this:
<ff-filter-cloud>
<h4>The Filter Cloud</h4>
<div>
<div>Custom above</div>
<div data-template="filter" class="filter-element">
<span>Group 1: Element 1</span><span> ×</span>
</div>
<div data-template="filter" class="filter-element">
<span>Group 2: Element</span><span> ×</span>
</div>
<div data-template="filter" class="filter-element">
<span>Group 3: Element 3</span><span> ×</span>
</div>
<div>Custom below</div>
</div>
</ff-filter-cloud>Blacklist
If you want to exclude specific facets from the filter cloud, you can use the blacklist attribute. You may specify as many facets as you need, separated by commas. The values must correspond to the facets's associatedFieldName property returned by FactFinder.
Setup
This example will blacklist all filters applied by the Price and Size facets.
<ff-filter-cloud blacklist="Price,Size">
<div>
<span data-template="filter">{{facet.name}}: {{element.text}}</span>
</div>
</ff-filter-cloud>Whitelist
If you want to exclusively specify each facet, you can use the whitelist attribute. Like in blacklist, you may specify as many facets as you need, separated by commas. The values must correspond to the facet's associatedFieldName property returned by FactFinder.
Setup
This example will whitelist only filters applied by the Brand and Category facets.
Filter click
There is only one delegated click listener for the filter elements, and it is attached to ff-filter-cloud itself. Click events on filter items bubble up to ff-filter-cloud and are processed there.
By default, clicking on a filter item removes it. You can attach your own click listener and call event.stopPropagation() to prevent default behavior.
See the example below that shows how to create a filter element with a clickable x button:
Demo
API
ff-filter-cloud
Properties
blacklist (String) (default: undefined)
A comma-separated list of facet field names that should not appear in selected filters. Changing this value updates ff-filter-cloud without a FactFinder request. Do not use this with whitelist. The component throws an error and does not render.
order (String) Options: "alphabetical", "fact-finder", "user-selection" (default: "fact-finder")
Sorts filter elements alphabetically, in FactFinder order, or by user selection. Changing this value updates the component without a FactFinder request. Unsupported values cause an error and prevent rendering.
whitelist (String) (default: undefined)
A comma-separated list of facet field names that exclusively appear in selected filters. Changing this value updates ff-filter-cloud without a FactFinder request. Do not use this with blacklist. The component throws an error and does not render.
Events
dom-updated
This event is triggered when the element has received new data and the template for this element and all sub elements have been punched out.
Last updated
Was this helpful?