Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ZedR on Dec 02, 2008 06:00
open dhtmlx forum
standard versions context menu & tree

Hi,

Please help. The following code does not work with standard versions of dhtmlxMenu & dhtmlxTree as shown in the sample online: ( There is no file not found kind of error)

function onButtonClick(menuitemId,type){
var id = tree.contextID;
tree.setItemColor(id,menuitemId.split("_")[1]);
}
//init menu
var menu = new dhtmlXMenuObject(null,"standard");
menu.setImagePath("../../../dhtmlxMenu/codebase/imgs/");
menu.setIconsPath("../images/");
menu.renderAsContextMenu();
menu.setOpenMode("web");
menu.attachEvent("onClick",onButtonClick);
menu.loadXML("_context.xml");

tree.attachEvent("onBeforeContextMenu",function(itemId){
if (tree.hasChildren(itemId) > 0){
menu.hideItem('outher');
} else {
menu.showItem('outher');
}
return true
})


Thanks a lot.
Answer posted by Support on Dec 02, 2008 09:15
Please beware that standard version doesn't support
    tree.enableContextMenu
command, so you will not be able to use such integration. 
Still it possible to open context menu directly from onBeforeContextMenu event handler, or use menu.addContextZone("tree_container") to attach the menu to whole tree container.