View Full Version : When is the "right time" to hide some of menu items?

26 Aug 2009, 2:05 PM
I am using multi-level context menu in my project. Depending on "context" I would like to hide some of the menu items in some of sub-menus. I have tried to do it at following places:

"contextmenu" event handler which shows the menu
"beforeshow" event handler of the top level menu
"beforeshow" event handled of sub-menu with items I wont to hide/show

The only one which is working is "beforeshow" on sub-menu. In first two cases, findById() fails to find menu item I am trying to show/hide. I really would like to have all code which handles visibility of menu items in one place and not spreaded across listeners of all my sub-menus. Is it possible?