当我使用列布局时,看不到我的labelFields
我的字段以列为单位,但没有标签

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]
            }
        ]
    });

最佳答案

它们使我习惯于在列布局中实现字段,就像这样……

var form = new Ext.FormPanel({
  labelAlign: 'top',
  items: [{
      layout:'column',
      defaults: {
        columnWidth: 0.5
      },
      items:[{

          layout: 'form',
          items: [{
              xtype:'textfield',
              fieldLabel: 'Top Left',
              name: 'first',
              anchor:'95%'
          }, {
              xtype:'textfield',
              fieldLabel: 'Bottom Left',
              name: 'third',
              anchor:'95%'
          }]
      },{
          layout: 'form',
          items: [{
              xtype:'textfield',
              fieldLabel: 'Top Right',
              name: 'last',
              anchor:'95%'
          },{
              xtype:'textfield',
              fieldLabel: 'Bottom Right',
              name: 'email',
              anchor:'95%'
          }]
      }]
  }]
});

试试看,告诉我它是否适合您...

关于extjs - EXTJS,应用布局时出现问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3460015/

10-11 04:51
查看更多