我使用Ext.menu.Menu列出项目,并想要遍历它们以查找特定值。
new Ext.Container({
width: 560,
height: 250,
layout: 'hbox',
items: [
new Ext.menu.Menu({
items: [
{
text: 'Today',
handler: function() {
},
scope: this
}
].concat([
{
text: 'Yestaerday',
handler: function() {
},
scope: this
}, {
text: 'Month'
handler: function() {
},
scope: this
}
]).concat([
{
text: 'Year',
handler: function() {
},
scope: this
}]
})
在上面的代码中我尝试删除文本值为" Yestaerday和Month"的项目。如何循环浏览菜单项以查找要删除的等效文本值?thx
答案 0 :(得分:0)
尝试使用ComponenetQuery
Ext.ComponentQuery.query('button[text=Yestarday],button[text=Month]');
你会得到按钮对象。
答案 1 :(得分:0)