在这个简短函数的最底部,您可以看到我正在尝试获取xtype: button
中的所有webClip
。由于某种原因,它省略了57x57按钮并仅显示titlebar
中的删除按钮。我无法弄清楚为什么。这个xtype: field
的{{1}}配置对我来说相当混乱。谢谢!
component
Console.log结果:
function addWebClip(type) {
var webClip = Ext.create('Ext.form.FieldSet', {
cls: 'webclip-title',
items: [{
xtype: 'titlebar',
title: type + ' webclip',
items: [{
text: 'remove',
ui: 'decline',
align: 'right',
handler: function () {
console.log(this.hasParent()); // TRUE
Ext.getCmp('main-panel').remove(this.up('fieldset'));
}
}]
}, {
xtype: 'field',
label: 'Icon',
cls: 'icon-input',
component: {
xtype: 'button',
width: 57,
height: 57,
iconCls: 'add1',
iconMask: true,
handler: function () {
var gallery = Ext.getCmp('images-gallery');
if (!gallery) {
gallery = Ext.Viewport.add({
xtype: 'gallery',
id: 'images-gallery'
});
}
console.log(this.hasParent()); // FALSE
gallery.setIconButton(this);
gallery.show();
}
}
}, {
xtype: 'textfield',
name: 'webClipImage[]',
label: 'webClipImage'
}]
});
console.log(webClip);
console.log(webClip.query('.button'));
Ext.getCmp('main-panel').add(webClip);
}
答案 0 :(得分:1)
这就是你找到按钮的方法:
console.log(webClip.down('field[cls=icon-input]').component);