When creating a context menu for a tree from scratch by script, dhtmlxMenu crashes, claiming “polygon is undefined”.
How to test:
Adjust example “Context menu based on item properties” by replacing
menu.loadXML("_context.xml");
with
menu.addNewSibling(null, ‘test’, ‘This is a test’, false);
.
It works for menus that aren’t content menus. It also works by loading the elements from XML (either a string or a file). Just not when you’re creating the menu by script.
Workaround:
Use pageTreeMenu.loadXMLString(…) for the first item to add, you can adjust the menu by script from there on.
Please, try to use the same approach as in the following post to create context menu using script:
dhtmlx.com/docs/products/kb/inde … mal&q=6758