Posted 5 August 2020, 7:58 am EST
Hi!
I am trying to add (dynamic) sub menus to my Wijmo Menu Component, but I am not able to display the sub menus.
I had created the menu component with some help from here. (https://www.grapecity.com/forums/wijmo/using-flexgrid-and-context
)
This is my current menu definition:
<!-- ko with: menuViewModel -->
<div id="contextmenu"
data-bind="wjMenu: {
initialized: initMenu,
itemClicked: contextMenu,
header: 'File',
subItemsPath: 'items',
}"
style="display: none"></div>
<!-- /ko -->
In the initMenu function I add the menu items now like this:
const menuItems = getMyMenuItems();
menuItems.forEach((menuItem, index) => menu.itemsSource[index] = menuItem)
menu.itemsSource.length = menuItems.length;
menuItems looks like this:
[
{
"header":"Löschen",
"value":"delete"
},
{
"header":"Submenu",
"value":"with_submenu",
"items":[
{
"header":"test",
"value":"sub_test"
},
{
"header":"test2",
"value":"sub_test2"
}
]
}
]
I am wondering if I am doing anything wrong, because it does show both top level entries, but no sub menu for the 2nd entry.
I also tried removing the value of the 2nd entry, but then the menu only shows the first entry.