1
我需要在窗体上调用doLayout之后设置labelWidth属性。Extjs 3.3动态添加字段到表单并设置其标签宽度
似乎在表单呈现完成之后,序列对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后,所有的标签都被设置为100像素。
感谢您的帮助