How to add a context menu to the layout cell behind a tree

Can you please explain if and how I can add a context menu (e.g., a right click menu) that will appear when I right click on the white space around a tree? Am using the File Manager demo app and want the menu to let me add root nodes and some other operations. Don’t want to use a button nor toolbar nor menu item.

Try the next approach:

menu = new dhtmlXMenuObject("menuDiv"); menu.setIconsPath("../___img/"); menu.renderAsContextMenu(); menu.loadXML("../___xml/m_context.xml"); menu.attachEvent("onBeforeContextMenu", function(zoneId){ if(zoneId=="treeDiv") return false; else return true });

Sorry, you need it for LAYOUT CELL…
Can you add an image and mark there a context menu area? How do you see that?

Darya, I’m not sure what ur saying. Creating a menu object isn’t so much the issue as it is getting the layout cell to respond to the right click event.