gpt4 book ai didi

javascript - 在 ExtJS 中,如何循环遍历菜单项?

转载 作者:数据小太阳 更新时间:2023-10-29 05:43:02 25 4
gpt4 key购买 nike

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

最佳答案

使用 MixedCollection 的 'each' 方法按钮菜单中的实例。

假设定义如下:

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('');
});

关于javascript - 在 ExtJS 中,如何循环遍历菜单项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3523733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com