repoTree.enableContextMenu(menu); is not a function

Hi,
I am loading a Tree object in a layout. OnRightClick of the tree i need to display a contextmenu. So as my code follows below.

menu = new dhtmlXMenuObject();
menu.setIconsPath(“dhtmlx/layout/imgs/”);
menu.renderAsContextMenu();
menu.attachEvent(“onClick”, onButtonClick);
menu.loadXML(“${path}/dhtmlx/tree/TreeOptions.xml”);
repoTree.enableContextMenu(menu);

So when i place this code i get an error message saying that repoTree.enableContextMenu(menu); is not a function…So pls can any one help me out in this…

enableContextMenu is available only in pro version of dhtmlxtree
( standard one , has onRightClick event , which can be used for the similar purpose )

Hi,
I already added onRightClick function which was given by dhtmlx docs…But i am getting an alert as followed below and i am not getting contextMenu…

            repoTree.attachEvent("onRightClick", function(id, e){
	menu = new dhtmlXMenuObject();
	menu.setIconsPath("images/");
	menu.renderAsContextMenu();
	menu.attachEvent("onClick", onButtonClick);
	menu.loadXML("${path}/dhtmlx/tree/TreeOptions.xml");
	alert(id);

Thanks

The code which you are using - inits menu, not shows it
You need to

a) move init code outside of onRightClick
b) call menu.show from onRightClick

Thanks stanislav, it worked for me…