我似乎在这里遇到了一个奇怪的问题。扩展组件具有以下代码:
MyApp.panels.RelationshipDetails = Ext.extend(Ext.FormPanel, {
closable: true,
relationshipId: null,
documentId: null,
title: 'Relationship',
initComponent: function () {
if (!this.verifyRequiredData()) {
MyApp.panels.RelationshipDetails.superclass.initComponent.call(this);
return;
}
// Build components
this.tbar = this.buildToolbar();
this.items = this.buildDetailItemArray();
MyApp.panels.RelationshipDetails.superclass.initComponent.call(this);
},
verifyRequiredData: function () {
// Verification code here
},
buildDetailItemArray: function () {
return [{
xtype: 'fieldset',
title: 'Details',
collapsible: true,
autoHeight: true,
items: [{
xtype: 'hidden',
name: 'Id'
}, {
xtype: 'textfield',
fieldLabel: 'Name',
name: 'Name'
}, {
xtype: 'textfield',
fieldLabel: 'Description',
name: 'Description'
}, {
xtype: 'button',
text: 'Save',
name: 'saveButton'
}]
}];
},
buildToolbar: function () {
return new Ext.Toolbar({
// Toolbar Config
});
}
});
问题是当这个面板呈现时,工具栏是唯一呈现的东西。通过调试,我可以看到它BuildDetailItemArray()
被正确调用并返回正确的结果。
当我注释掉该this.tbar =
行时,它变得更加奇怪,因为当工具栏不存在时,字段集和字段会正确呈现。即使我扩展Panel
而不是FormPanel
. 我还尝试将表单字段抽象到它自己的组件中,并且发生了同样的事情。
任何人都知道为什么这似乎不起作用?