I have 2 trees on the page and I want both of them to have a context menu, different menus. Is it possible?
Sure, you can use dhtmlxMenu and
tree.enableContextMenu(menu_obj);
to use menu as context menu of tree ( works in pro version only )
In case of standard edition of tree, you can use onRightClick event of tree, and call any kind of custom context menu from it.
Sorry, may be I wasn’t clear. I declared 2 trees(dhtmlXTreeObject) and 2 context menus (dhtmlXMenuObject) and used enableContextMenu() method to attach
menu1 to tree1 and menue 2 to tree2. It doesn’t work in my case. Is it supported?
Please provide code snippet used in problematic case.
There is no any restrictriction on count of components or context menus per page
I had no problems with only one tree having a context menu, everything was working perfectly well. The problem started when I added the second menu to the second tree. Thanks you.
menu = new dhtmlXMenuObject(null,“standard”);
menu.renderAsContextMenu();
menu.setOpenMode(“web”);
menu.attachEvent(“onClick”,onButtonClick);
menu.loadXML(“FAQ/xml/_tree_context.xml”);
menu_list = new dhtmlXMenuObject(null,“standard”);
menu_list.renderAsContextMenu();
menu_list.setOpenMode(“web”);
menu_list.attachEvent(“onClick”,onButtonClick);
menu_list.loadXML(“FAQ/xml/_list_context.xml”);
tree=new dhtmlXTreeObject(‘treeboxbox_tree’,“100%”,“100%”,0);
tree.enableContextMenu(menu);
tree.attachEvent(“onBeforeContextMenu”, showContextMenu);
tree.loadXMLString( transformedXMLTree );//load root level from xml
list=new dhtmlXTreeObject(‘doc_list’,“100%”,“100%”,0);
list.enableMultiselection(true);
list.loadXMLString(transformedXMLList);//load root level from xml
The problem can’t be reconstructed with provided code - working sample sent by email
It’s working fine, my mistake!