您的位置:首页 > Web前端 > JavaScript

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

2016-05-27 16:03 976 查看
摘自:http://blog.csdn.net/suixufeng/article/details/6587989

原因: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了

 

错误示例:

[php] view
plain copy

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   

        }]   

    });    

需改动的:

[php] view
plain copy

layout: 'table',  

layoutConfig: {columns: 2},  

items: [{  

  layout: 'form',  

  colspan: 2,   

  items: [{  

    xtype: 'textfield'  

    fieldLabel: 'My Label',   

    disabled: true,  

  }]  

}]  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: