Home > widget-integration > FilterAPI > addShowFilterTreeParam
FilterAPI.addShowFilterTreeParam() method
Adds showFilterTree parameter based on filter toggle button state.
Checks the filter toggle button state in FilterStore and includes showFilterTree flag if the filter tree should be displayed. This is used for mobile/off-canvas filter layouts. Override to customize filter tree visibility logic.
Signature:
protected addShowFilterTreeParam(params: FilterAPIParams): FilterAPIParams;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
params |
Current filter parameters being built |
Returns:
Enhanced parameters with showFilterTree flag if toggle button state is active
Remarks
Filter Tree Visibility: - Only adds flag if filter-toggle-button state exists and showFilterTree is true - Used primarily for mobile and off-canvas filter layouts - API uses this to return appropriate filter tree data
Example
Override to force filter tree display:
window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
return class CustomFilterAPI extends FilterAPI {
protected addShowFilterTreeParam(params) {
const enhanced = super.addShowFilterTreeParam(params);
// Always show filter tree for mobile users
if (this.helper.isMobile()) {
enhanced.showFilterTree = true;
}
return enhanced;
}
};
});