原因:fieldLabel is not rendered by the field itself, but by FormLayout. So for you to have a label you need to put the field in a form layout, e.g.
在coluumn的子项中加上layout:'form'就ok了
在coluumn的子项中加上layout:'form'就ok了
错误示例:
需改动的:
var d = new Ext.Window({
title: instance,
layout: 'border',
width:375,
height:275,
cls: 'x-dialog-popup-main',
items: [{
region: 'center',
title: 'General Information',
layout: 'table',
layoutConfig: { columns: 2 },
items: [
new Ext.form.TextField({
colspan: 2,
fieldLabel: 'My Label',
disabled: true,
hideLabel: false
})
]
}, {
region: 'south',
title: 'Controls',
height: 100
}]
});
需改动的:
layout: 'table',
layoutConfig: {columns: 2},
items: [{
layout: 'form',
colspan: 2,
items: [{
xtype: 'textfield'
fieldLabel: 'My Label',
disabled: true,
}]
}]