When the sidebar is collapsed,
the sub-items appear in a popup, and in that case they lose there icon.
Is there an easy way to make them displayed as they are when the sidebar isn’t collapsed ?
I’ve would expected something like this to override popup list items template but it doesn’t work:
{
"view": "sidebar",
"data": [...],
"popup": {
template: (obj) => `<span class='webix_icon ${obj.icon}'></span> ${obj.value}`
}
}
I’ve actually found the following solution, but it is a little bit hacky.
Snippet : Code Snippet
// After sidebar initialization
$$('$sidebar1').getPopup().getBody().getChildViews()[1].define(
'template',
(obj) => `<span class='webix_icon ${obj.icon}'></span> ${obj.value}`
);
// need to fix the css for the icon not to be aligned right
<style>
.webix_sidebar_popup_list.webix_sidebar_popup_left .webix_icon {
float: none;
line-height: 1;
width: 20px;
}
</style>