Home > widget-integration > FilterRender > clearAllFilters
FilterRender.clearAllFilters() method
Clears all active filters and resets the filter state.
Removes all selected filters from state, clears all URL query parameters, emits FILTER_RESET to trigger a new API call, and scrolls to the top.
Signature:
clearAllFilters(options?: {
preventPushHistory?: boolean;
target?: EventTarget | null;
}): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ preventPushHistory?: boolean; target?: EventTarget | null; } |
(Optional) Configuration options |
Returns:
void
Example
Override to add a confirmation before clearing:
window.boostWidgetIntegration.extend('FilterRender', (FilterRender) => {
return class extends FilterRender {
clearAllFilters(options) {
if (confirm('Clear all filters?')) {
super.clearAllFilters(options);
}
}
};
});