Does anyone knows how to override the clear button event of a checklist, my scenario is to clear two checklist filters selections by clicking clear button of one of them. Anyone knows how to achieve that or what is the event triggered by clear button?
If you want to override how the default script works all you need to do is to override
removeFacet() function in
component-search-results-filter script of Search base theme.
Few things you need to know:
- all search renderings are using/can use signatures (each filter support one or multiple signatures) - so it's not just about unselecting elements in UI but also removing params from the hash in the URL
- you need to get a list of all filters on the page - take a look at
getFacetDataRequestInfo()function in the same file and you can use a similar approach
- all the all of the filters need to have a fact assigned - you can check the data properties of Backbone model (it's stored there after parsing data attributes, the same with signatures) - this information is required to know what to remove from the hash