#100741
Hristofor
Member

Hi Tünde Keller,
In order to enable ‘checkbox’ mode or other dynamically for a specific SmartMenuItemsGroup, simply set the checkable property to the target SmartMenuItemsGroup. CheckBox mode is set as the default checkMode. You can change that as well if you need. For example in your code:


function AddItems() {
...
let subMenu = document.createElement(‘smart-menu-items-group’);
subMenu.checkable = true;
subMenu.innerHTML = ‘Item 0’
...
}

SmartHTML elements are custom elements and as such they have properties that can be applied dynamically or statically. So the following code is incorrect:


subMenu.setAttribute(“checkable”, “”)
subMenu.setAttribute(“check-mode”, “checkbox”)
newItem.setAttribute(“checked”, “”)

In order to set those properties to the SubMenu or the menu you need to set them directly as properties. See the API for additional information.
Best Regards,
Christopher
Smart HTML Elements Team
https://www.htmlelements.com