Home > widget-integration > FilterHandler > handleActionMapping
FilterHandler.handleActionMapping() method
Handles action mapping system for legacy filter tree actions.
Maps data-action attributes to their corresponding handler functions stored in the actionMapping state. This legacy system uses attributes in the format "key.id" to look up action handlers. Override this method to customize action mapping lookup logic or add preprocessing for mapped actions.
Signature:
protected handleActionMapping(target: HTMLElement): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
target |
HTMLElement |
The clicked DOM element with data-action attribute |
Returns:
void
Remarks
Action attribute format: "key.id" where: - key: Action category (e.g., 'option', 'filter') - id: Unique identifier for the specific action
The actionMapping state structure:
{
[key]: {
[id]: {
[actionHandler]: actionConfig
}
}
}
This is a legacy system being phased out in favor of EVENT_NAMES.
Example
Extend to add logging for mapped actions:
window.boostWidgetIntegration.extend('FilterHandler', (FilterHandler) => {
return class CustomFilterHandler extends FilterHandler {
protected handleActionMapping(target) {
const actionId = target.dataset.action || target.getAttribute('data-action');
if (actionId) {
// Log action for debugging
console.log('Action mapping triggered:', actionId);
// Track action for analytics
analytics.track('filter_action', { action_id: actionId });
}
super.handleActionMapping(target);
}
};
});