When performing a complex query, based on several active facets and filters, its tedious for the user to start from scratch if she has to unset all refinements one by one. Thanks to the clearAll widget, this task becomes a one click action for the user and is trivial to implement for us developers as it requires no configuration.
Instructor: [00:00] We need to provide an easy way for our users to reset their search refinements. That's the clearAll widget's mission. Extremely simple to add. The container in our HTML file first. Let's add it to the top of our refinement column on the left and give it an ID of clearAll. Then, in app.js, search, add widget, instantsearch, widgets, and clearAll.
[00:28] Configuring the container, the ID is clearAll. We refresh the page. Nothing changes yet. Then, if we refine on the brand facet, for instance, we now have a "Clear all" link that appears on top. Clicking it will clear all the active refinements.
[00:49] We can change the "Clear all" default string to add whatever we want. In templates link, let's add "Reset everything." Now, refining on a brand, the link displays "Reset everything" instead. Note that as the name implies, this widget clears all refinements, not only the facets, but also numerical values like the range input down there.