Guide

Filter Manager

5min

Filter Manager is a helper class that takes care of the state of filters. What filters are currently selected and what should be sent. It can be passed to listFilters() and then the result is automatically applied to the state. Modifier applyFilterWithManager() can base used to apply the current state of filters to query.

Here is an pseudo code example how to use filter manager. First there is initialization and the search:

JS


Now you have tools to manage filters with FilterManager. To render currently available filters you can use manager.options and manager.sliders. Sliders include numerical values like price.

JS


To toggle between options you can use toggleOption method.

JS


Event

This will change the state of option selection in the filter manager. Now you have to just call mySearch() again to fetch results of changed state. You can do this directly by calling the function or listening a Events (analytics)

JS


Clearing all selections

To clear all or single category option selections you can use clearOptionSelections function.

JS


Exporting and importing selections from URL

FilterManager has methods to load current state into URL query parameters and a method to load current

JS