Home > widget-integration > FilterRender > handleCollapse

FilterRender.handleCollapse() method

Applies a single collapse action to the filter tree DOM.

Adds or removes CSS classes on the target elements specified in the action object, scoped to the current filter tree parent element.

Signature:

handleCollapse(action: any): void;

Parameters

Parameter

Type

Description

action

any

Collapse action with target element IDs and class toggles

Returns:

void

Example

Override to add custom collapse tracking:

window.boostWidgetIntegration.extend('FilterRender', (FilterRender) => {
  return class extends FilterRender {
    handleCollapse(action) {
      super.handleCollapse(action);
      if (action?.actionId) {
        this.analytics.track('filter_collapsed', { id: action.actionId });
      }
    }
  };
});