在表单上调用 doLayout 后,我需要设置 labelWidth 属性。
似乎在表单呈现后,对 do 布局的序列请求忽略了表单的 labelWidth 属性,并设置为 100px 默认值。
Nipendo.ProformaInvoice.View = Ext.extend(Ext.FormPanel,{
constructor: function (config) {
if (!config) {
Nipendo.showError({ title: 'Error', message: 'A error occurred while loading the invoice view. A configuration element is missing.' });
return;
}
if (!config.invoice) {
Nipendo.showError({ title: 'Error', message: 'A error occurred while loading the invoice view. The invoice element is missing.' });
return;
}
this.topToolbar = this.creatTopToolbar();
this.invoice = config.invoice;
var items = this.createDefaultLayout();
config = Ext.apply({
labelWidth: 140,
bodyStyle: 'padding:2px 5px;',
autoScroll: true,
tbar: this.topToolbar,
items: items
}, config);
Nipendo.ProformaInvoice.View.superclass.constructor.call(this, config);
}, // eo constructor
// private
handelBackToDefaultView: function (switchToView) {
if (this.currentViewName == 'sidebyside') {
this.removeAll();
this.currentViewName = switchToView;
this.add(this.createDefaultLayout());
this.doLayout();
}
this.currentViewName = switchToView;
}, //eo handelBackToDefaultView
})
调用handelBackToDefaultView 后,所有标签都设置为100px。
谢谢您的帮助