Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Johan de Vries on Mar 18, 2009 07:52
open dhtmlx forum
[dhtmlxTree] Creating a content menu by script

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.
Answer posted by Alex (support) on Mar 18, 2009 08:57

Please, try to use the same approach as in the following post to create context menu using script:

http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=6758