Skip to main content

template

Optional. Sets a template of displaying options in the popup list

template?: (item: any) => string;

Example

const combo = new dhx.Combobox("combo_container", {
template: function (item) {
return "<div style='display:inline-block'>"
+"<img style='width:20px;height:20px;margin-right:10px;' src="+item.src+"/></div>"
+ item.value + "</div>";
}
});

Related sample: Combobox. HTML template

The template function takes as a parameter an item of data collection and should return a string with a template for rendering options in the list.