关于在extjs中使用column布局,不能显示textfield的标签(fieldLabel)解决方法 子曰

 
原因: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了
 
错误示例:
var d = new Ext.Window({ 
        title: instance, 
        layout: 'border', 
        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,
  }]
}]

原文地址:https://www.cnblogs.com/suixufeng/p/3336178.html