1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    33
    Vote Rating
    0
    andy13c72back is on a distinguished road

      0  

    Default how to iterate through items in menu?

    how to iterate through items in menu?


    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

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,163
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    menu.items.each(function(item){
        // ...
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    33
    Vote Rating
    0
    andy13c72back is on a distinguished road

      0  

    Default


    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!

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,062
    Vote Rating
    215
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    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.

Similar Threads

  1. HOWTO ITERATE OVER TEXTFIELD ITEMS IN A TAB
    By rich71 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 21 Jul 2010, 8:57 AM
  2. How to Iterate over Panel items?
    By mtigua in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 2 Mar 2010, 11:40 AM
  3. [SOLVED] how to Iterate over FormPanel Items?
    By rissato in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 3 Jun 2009, 1:32 PM
  4. How to iterate over and change the CSS class of every combo items?
    By truszeka in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 26 Dec 2008, 4:31 PM
  5. Iterate through combo box items
    By Royan in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 6 Dec 2007, 12:18 AM

Thread Participants: 2