Home > widget-integration > FilterRender > renderOptionListTemplate
FilterRender.renderOptionListTemplate() method
Renders filter option values using the list template.
Generates HTML for list-style filter options with checkboxes and labels. Supports document count display and selected state management.
Signature:
renderOptionListTemplate(params: {
option: any;
values: any[];
dom: HTMLElement;
label: string;
showDocCount: boolean;
selectedKeys: Record<string, boolean>;
classNameSelected: string;
classNameUnselected: string;
}): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
params |
{ option: any; values: any[]; dom: HTMLElement; label: string; showDocCount: boolean; selectedKeys: Record<string, boolean>; classNameSelected: string; classNameUnselected: string; } |
List rendering parameters |
Returns:
Promise<void>
Remarks
Uses the filterOptionListTemplate from template system. Override to customize list item rendering or add shop-specific elements.
Example
Override to add custom list item attributes:
async renderOptionListTemplate(params) {
await super.renderOptionListTemplate(params);
// Add data attributes to list items
params.dom.querySelectorAll('.boost-sd__filter-option-listitem').forEach(item => {
const value = item.getAttribute('data-value');
item.setAttribute('data-popularity', this.getValuePopularity(value));
});
}