Reputation: 872
At the very bottom of this short function you can see that I'm trying to get all xtype: button
within the webClip
. For some reason it ommits the 57x57 button and shows only remove button from the titlebar
. I can't figure out why. This xtype: field
's component
config is rather confusing for me. Thanks!
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);
}
Console.log results:
Class {items: Class, _items: Class, innerItems: Array[9], onInitializedListeners: Array[0], initialConfig: Object…}
[Class]
> 0: Class
> length: 1
> __proto__: Array[0]
Upvotes: 2
Views: 3683
Reputation: 3411
That's how you can find your button:
console.log(webClip.down('field[cls=icon-input]').component);
Upvotes: 1