この短い関数の一番下でxtype: button
、webClip
. 何らかの理由で 57x57 ボタンが省略され、titlebar
. 理由がわかりません。これxtype: field
のcomponent
設定は私にとってかなり混乱しています。ありがとう!
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 の結果:
Class {items: Class, _items: Class, innerItems: Array[9], onInitializedListeners: Array[0], initialConfig: Object…}
[Class]
> 0: Class
> length: 1
> __proto__: Array[0]