How can you loop through all the items in an ExtJS toolbar menu, for example to change their icons?
Use the 'each' method of the MixedCollection instance in the button's menu.
Assuming a definition like:
var pnl = new Ext.Panel({
tbar: [
{
itemId: 'a_btn',
text: 'A menu button',
menu: {items: [
{
text: 'Item 1'
},
{
text: 'Item 2'
}
]}
}
]
});
You can then later do:
var btn = pnl.getTopToolbar().get('a_btn');
btn.menu.items.each(function( item ) {
item.setIconClass('');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With