EXTJS,应用布局时出现问题

Mar*_*ayi 2 extjs

当我使用列布局时,我看不到我的labelFields我的字段在cols中,但是没有标签

var familyNameTextField = new Ext.form.TextField({
        fieldLabel : 'Ville',
        allowBlank:false,
        id : 'familyName'
    });
    var myData = [['EDF','EDF'],['GDF','GDF']];

    //The text field for the First Name
    var firstNameTextField = new Ext.form.ComboBox({
        fieldLabel: 'State',
        hiddenName:'state',
        store: new Ext.data.ArrayStore({
            fields: ['abbr', 'state'],
            data : myData // from states.js
        }),
        valueField:'abbr',
        displayField:'state',
        typeAhead: true,
        mode: 'local',
        triggerAction: 'all',
        emptyText:'Select a state...',
        selectOnFocus:true,
        width:190
    });
    //The text field for the First Name
    var demarcheField = new Ext.form.TextField({
        fieldLabel : 'Démarche',
        allowBlank:false,
        id : 'demarche'
    });
    //Button to show the MessageBox
    var showMessageBoxBouton = new Ext.Button({
        text:'Say Hello',
        handler:showMessageBox //The function that will be called when the button is clicked
    });
    //The form that will contain all our components
    var myForm = new Ext.FormPanel({
        labelWidth: 115,
        frame:true,
        title: 'Personal informations',
        bodyStyle:'padding:5px 5px 0',
        width: 900,
        autoScroll:true,
        layout:'column',
        items: [{
                items:[
                    familyNameTextField
                ]
            },
            {
                items:[firstNameTextField]
            },
            {
                items:[demarcheField]
            },
            {
                items:[showMessageBoxBouton]
            }           
        ]
    });
Run Code Online (Sandbox Code Playgroud)

ob1*_*ob1 5

自从使用ColumnLayout替换FormPanel的默认布局(FormLayout)后,您才看到标签.

从FormPanel文档:

默认情况下,FormPanel配置为layout:'form'以使用Ext.layout.FormLayout布局管理器,它可以正确地设置样式并呈现字段和标签.在FormPanel中嵌套其他容器时,应确保任何托管输入字段的后代容器使用Ext.layout.FormLayout布局管理器.

因此,嵌套容器的布局:'form'在列布局中,您将看到标签