PDA

View Full Version : how to iterate through items in menu?



andy13c72back
10 Mar 2011, 12:07 AM
Sorry for my newbie question, I'm trying to bind 'contextmenu' event to all menuitems in a menu, please advice how to iterate through each item within that menu?

Thx

evant
10 Mar 2011, 12:12 AM
menu.items.each(function(item){
// ...
});

andy13c72back
10 Mar 2011, 12:32 AM
yes, that's what I want. but there's another problem, as the contextmenu is shown on top of another menu(main menu), when the contextmenu showed the main menu would be automatically closed, how can I prevent the main menu from closing?

thx again!

slemmon
10 Mar 2011, 6:41 AM
Try adding the config option of hideOnClick: false to the menu item that opens the sub-menu. That should prevent the parent menu from hiding when you click the item with a sub-menu.