在 ExtJS 中,如何循环菜单项?

2024-01-12

如何循环遍历 ExtJS 工具栏菜单中的所有项目,例如更改其图标?


使用 'each' 方法混合系列 http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.MixedCollection按钮菜单中的实例。

假设定义如下:

var pnl = new Ext.Panel({
    tbar: [
        {
            itemId: 'a_btn',
            text: 'A menu button',
            menu: {items: [
                {
                    text: 'Item 1'
                },
                {
                    text: 'Item 2'
                }
            ]}
        }
    ]
});

然后您可以稍后执行以下操作:

var btn = pnl.getTopToolbar().get('a_btn');

btn.menu.items.each(function( item ) {
    item.setIconClass('');
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 ExtJS 中,如何循环菜单项? 的相关文章