Facets (ASN)
Build customizable facets, filters, and range sliders.
Documentation
Using the After Search Navigation
You can use the ASN by adding one line to your HTML code.
<ff-asn></ff-asn>Doing so will cause the ASN to use default HTML templates for all filters. You can customize the ASN's appearance by providing your own templates for its elements.
Adding a filter group
<ff-asn>
<ff-asn-group></ff-asn-group>
</ff-asn>To customize filter groups you add ff-asn-group elements. However, adding an empty ff-asn-group as in the example above has no effect. You will likely want to specify your own HTML template as shown in the following sections.
Changing the group caption
If you want to change the group caption, you can annotate an HTML element with the slot="groupCaption" attribute. You can access the group's name through {{group.name}}.
Here is an example of how a custom group caption could be implemented:
<ff-asn-group>
<div slot="groupCaption" class="groupCaption">
{{group.name}}<span class="filterArrowDown">↓</span>
</div>
</ff-asn-group>Structuring the filter group
After Search Navigation groups offer various parts to interact with. They are marked with the data-container attribute.
There are two containers to hold the group's filter items:
data-container="detailedLinks"data-container="hiddenLinks"
detailedLinks are the filter items which should be displayed immediately when the group receives data.
hiddenLinks are the filter items which should stay hidden until they are needed.
For further interaction there are:
data-container="showMore"data-container="showLess"data-container="removeFilter"
These three elements are optional. If you don't define them in your template, they will be generated automatically.
showMore provides a clickable element to expand the hiddenLinks. It is only visible when there actually are hiddenLinks and these are not already expanded.
showLess provides the opposite function by collapsing expanded hiddenLinks.
removeFilter allows you to deselect all filters of the ASN group. It only appears when there are selected filters that can be deselected. That means that if there are only implicitly selected or fixed filters, the removeFilter element will not appear.
Adding a filter element template
A filter group typically contains many elements. This could be for instance all colors or all manufacturers that apply to the current search result. You can customize the appearance of these entries by inserting the ff-asn-group-element into the related ff-asn-group.
The ff-asn-group-element provides two slots to distinguish between selected and unselected elements. Their content may be freely specified.
The position of the ff-asn-group-element inside the ff-asn-group does not matter as long as it is a direct child. After initialization the element is removed from the DOM and saved for later usage.
The {{data-binding}} for the ff-asn-group-element allows accessing both scopes—the {{element}} scope and the {{group}} scope. This is especially important if you want to display the unit which is configured on the server side. In addition, ff-asn-group-element does support image binding.
Restricting filter group templates to filter-style
If you set the filter-style attribute, the ff-asn-group acts as the default template for all groups that match this filter-style.
Defining filter group templates for individual groups
By setting the for-group attribute you can apply a template to a single group identified by its source field name (associatedFieldName).
Using native select box
If you require a native select element for the hiddenLinks instead of the "show more/show less" implementation, you can add the select-box="true" attribute to the ff-asn-group and add a select element with the attribute data-container="hiddenLinks".
Note that you should also supply an option element that acts as a placeholder. This element typically reads "More..." and is initially shown before the select dropdown was opened for the first time.
You may optionally define a template for the regular option elements. It supports data binding as usual. Make sure to mark it with the data-template attribute.
Searchable ASN groups
When the number of available filters in the ASN group is large, you may want to render a search field inside the group to allow the user to narrow down displayed filters.
To enable this feature you have to set the minimum number of filters required to render the search field in a given group. This is done by setting the searchable-from attribute on the ff-asn element. If you wish to exclude some groups from being searchable regardless of the number of filters, you can set the not-searchable attribute on such an ff-asn-group element.
Search field template
The default search field template is:
However, it can be changed by providing own content for the filterSearch slot in the ff-asn-group template. This template has to contain exactly one input element.
Hit highlighting
The searchable ASN groups feature comes with hit highlighting. Strings that match the search term will be wrapped with a <span class="ffw-query"> element to allow you to apply appropriate styling.
In order to tell the template engine to interpret the HTML instead of render it as plain text you have to use triple curly braces for the group element's name. See Template Engine for details.
Example
Suppose you type art into Manufacturer's search box.
Sliders
FactFinder Web Components offer two kinds of sliders with different ways to interact. Sliders use their own ASN group element: ff-asn-group-slider. Both types of sliders require the same basic setup.
Instead of detailed and hidden links, ff-asn-group-slider requires an ff-slider-control element. Here you define how the input fields for the upper and lower values shall be displayed and how they shall behave. You also specify whether you want to use the One Touch Slider or the classic slider.
One Touch Slider
The One Touch Slider lets you control the min and max values together. This requires only one request to FactFinder for the selected range. You can still move each handle individually.
The One Touch Slider takes no further HTML template. It relies on CSS and inline styling. Inspect rendered HTML from an official or self-made demo for suitable customization rules.
The CSS classes involved are ffw-triangle, ffw-slider-button-left, ffw-slider-button-right, ffw-line, ffw-selected-range, ffw-no-transition, and ffw-active.
Also see default-styles.css in the Web Components distribution for further details.
Classic slider
The classic slider allows you to manipulate one handle at a time. Each change issues a filter request to FactFinder.
The ff-slider takes two elements with a slot attribute. These elements are used as the min and max handles. Additional HTML in the template will be discarded.
Rendered HTML
The following is a listing of possible HTML that is rendered by ff-asn. Notice the CSS classes starting with ffw-. These are applied automatically and shall provide you an easy way to apply custom style rules.
Remove all filters
Sometimes you may want to reset all filters at once and go back to the original search result. For this case there is a dedicated element which you can place anywhere on your page. This element will trigger a new search request with the current search query.
The ff-asn-remove-all-filter element has the following properties:
show-always
With the show-always property you can define whether the element is always visible or only when at least one removable filter is set. The default value is false.
remove-params
Setting this attribute removes all parameters, except the search query, from the resetting request. When not set, only parameters applied by the ASN are removed. Other parameters, such as products-per-page, sort, and custom parameters, remain unaffected. The default value is false.
keep-category-path
Setting the keep-category-path property preserves the category filters. The default value is false.
Dispatching data manually
If you need to manually dispatch data, for instance when the component is subscribed to a custom topic, you can use ResultDispatcher to achieve that. The ASN component requires the groups property's content from the FactFinder response. No additional preparation is needed.
Demo
Try the Facets demo.
API code
ff-asn
ff-asn-group
ff-asn-group-element
ff-asn-group-slider
ff-slider / ff-slider-one-touch
ff-slider-one-touch
ff-slider
ff-slider-control
ff-asn-remove-all-filter
Last updated
Was this helpful?