PDA

View Full Version : Iterate through nested menus



Slartibartfast
10 Nov 2009, 10:04 PM
I have a menu with sub menus with a config like this



{
id: 'menu1'
,items: [{
text: 'Item1'
,menu: {
items: [{
text: 'Sub Item1'
,handler: this.clickAction
},{
text: 'Sub Item2'
,handler: this.clickAction
}]
}
},{
text: 'Item2'
,menu: {
items: [{
text: 'Sub Item3'
,handler: this.clickAction
}]
}
},{
text: 'Item3'
,menu: {
items: [{
text: 'Sub Item4'
,handler: this.clickAction
}]
}
}]
}Is there a way to iterate through all items in all menus and sub menus?. I've looked at using cascade but it stops at the first level items. I could create a recursive function to go down each menu until an item is found. But is there an Ext way of doing this.

Thanks
Brian.

Animal
11 Nov 2009, 12:18 AM
cascade should work for you.