Categories | Question details Back To List | ||
Empty Context Menu I have a context menu attached to a tree with just one item. For some nodes of the tree I want to disable the menu item so I created a function which assigned to the tree using the setOnShowMenuHandler function. The function looks like: function setTreeContextMenuItems(itemId) { var somedata = getSomeData(itemId); if (somedata == "dont show") { // Still shows an empty menu. theTreeContextMenu.menu.hideButtons(); } else { theTreeContextMenu.menu.showButtons("removeNode"); } } If the hideButtons function is called, I see an empty box with no menu selections. What I want to do is not display any menu in this case. I tried replacing the hide and show buttons function calls with disableMenu (true and false) but the menu could not be restored once it was disabled. How can I hide this one item menu without showing an empty box when I want the item disabled? Paul Answer posted by Support on Aug 06, 2008 01:58 >>I want to do is not display any menu Just return false from event handler to block menu function setTreeContextMenuItems(itemId) { var somedata = getSomeData(itemId); if (somedata == "dont show") { return false; //block menu } else { return true; // allow menu } } Answer posted on Aug 06, 2008 15:05 Ok, thanks. |