2014-04-30 29 views
0

我有一個兩行兩列的表格 - 但我想以不同的順序排列每一行。分機表格佈局

第一行:(first column - width:30px, second column - width:270px)

第二行:(first column - width:130px, second column - width:170px)

我無法將兩行提取到不同的容器。我需要改變桌子。

我的代碼是:

var replacePanel = new Ext.Container({ 
     id:'replacePanel', 
     layout:'table', 
     border: false, 
     layoutConfig:{columns: 2}, 
     style: { "padding-bottom": "5px", margin: "5px 0 0 20px" ,"white-space":"normal"}, 
     items:[ 
      { 
       xtype: "checkbox", 
       name: 'replace_cb', id: 'replace_cb', 
       width: 15, style: "margin-top:5px;", 
       listeners: { 
        check: function (checkbox, checked) { 
         var settingsForm = Ext.ComponentMgr.get('settingsForm'); 
         settingsForm.changedFormula = true; 
         replacePanel.findById("replace_column").setDisabled(!checked); 
        } 
       } 
      }, 
      { 
       xtype: "label", width: 390, 
       text: getDomElement("profileSetting.customMetrics.useNewMetric").value, 
       style:'padding-left:5px; padding-right:5px; margin-top:5px' 
      }, 
      { 
       xtype: "container", width:160, style: "margin-top:4px", items: [ 
       { 
        xtype: "combo", width: 150, 
        name:'replace_column', 
        id:'replace_column', 
        allowBlank:false, editable: false, typeAhead: true, disabled: true, 
        triggerAction: 'all', lazyRender:true, mode: 'local', 
        store: new Ext.data.JsonStore({ id: 'storeForReplaceColumn', fields: ['id', 'displayText'] }), 
        valueField: 'id', 
        displayField: 'displayText', 
        listeners: { 
         afterrender: function(combo) { 
          if (Ext.isIE) { 
           Ext.get(combo.el.dom.parentNode).setWidth(160); 
          } 
         }, 
         select : function() { 
          var settingsForm = Ext.ComponentMgr.get('settingsForm'); 
          settingsForm.changedFormula = true; 
         } 
        } 
       }] 
      }, 
      { 
      xtype: "container", 
      html: getDomElement("profileSetting.customMetrics.whenReplacingMetrics").value 
      } 
     ] 
    }); 

回答

0

表的佈局是不是在這種情況下,很不錯的選擇。我會去vbox佈局的行和hbox佈局的列。

僞代碼:

vbox 
    item 1 (hbox) 
    left cell 
    right cell 
    item 2 (hbox) 
    left cell 
    right cell