Hi,
I’ve some trouble with a contextual menu on IE.
- I’ve a contextual menu attached to a tree
- when I make a right click on one item (the name of the item), I call onBeforeContextMenu event of the tree and the item is selected,
- when i make a right click near to an item (on the right of the item but not on his name), in chrome I call onBeforeContextMenu event of the menu, so the selection is cleared, and in IE it’s the tree event which is called, so the selection is never cleared.
Here is my code:
<div id="treebox" style="position:absolute;width:280px; height:500px;"></div>
<script>
//Contextual Menu Initialization
dhxMenu = new dhtmlXMenuObject();
dhxMenu.setIconsPath("../../Resources/theme/img/btn_entite/");
dhxMenu.renderAsContextMenu();
dhxMenu.addContextZone("treebox");
dhxMenu.attachEvent("onBeforeContextMenu",function(zoneId){
dhxTree.clearSelection();
return true;
});
dhxMenu.addNewChild(dhxMenu.topId, 0, "compare_node", "Compare this Object", true, "", "");
dhxMenu.addNewChild(dhxMenu.topId, 2, "advanced", "Advanced", true, "", "");
dhxMenu.addNewSeparator("advanced","separator_5");
dhxMenu.addNewChild("advanced", 3, "expand_node", "Maximize the selected branch", true, "", "");
dhxMenu.addNewChild("advanced", 4, "collapse_node", "Minimize the selected branch", true, "", "");
dhxMenu.addNewChild(dhxMenu.topId, 5, "property", "Properties", true, "", "");
//Tree Initialization
dhxTree=new dhtmlXTreeObject('treebox',"100%","100%",0);
dhxTree.setSkin('dhx_skyblue');
dhxTree.setDataMode("json");
dhxTree.enableContextMenu(dhxMenu);
dhxTree.attachEvent("onBeforeContextMenu", function(ASelectedId){
dhxTree.selectItem(ASelectedId);
return true;
});
dhxTree.enableSmartRendering(true);
dhxTree.setImagePath("imgs/");
dhxTree.setStdImages("223.png","223.png","223.png");
dhxTree.loadJSON("bdd/main_without_img.json");
</script>
Is there a way to correct this on IE ?
Thanks.