2014-05-19 29 views
5

ExtJS sürüm 4.2.1 kullanıyorum ve bir tablo düzenim var.ExtJS textfield genişliğini kapsayıcısına göre ayarlama

 Ext.create('Ext.panel.Panel', { 
      width: 1300, 
      height: 700, 
      title: 'Table Layout', 
      layout: { 
       type: 'table', 
       columns: 3, 
       tdAttrs: 
        { 
         width: 500, 
        } 
      }, 
      items: [ 
       { 
        fieldLabel: 'Text1', 
        xtype: 'textfield', 
       }, 
       { 
        fieldLabel: 'Text2', 
        xtype: 'textfield', 
       }, 
       { 
        fieldLabel: 'Text3', 
        xtype: 'textfield', 
       }, 
       { 
        fieldLabel: 'Text4', 
        xtype: 'textfield', 
       }, 
       { 
        fieldLabel: 'Text5', 
        xtype: 'textfield', 
       }, 
       { 
        fieldLabel: 'Text6', 
        xtype: 'textfield', 
       }], 
      renderTo: Ext.getBody() 
     }); 

ve sonuç: enter image description here her sütun genişliği 500 piksel ve onun kap ile ayarlamak için, her bir metin alanını genişliği istiyoruz. Bir şekilde bir autoWidth, Ama şimdi değil. textfields için yüzdeler

cevap

5

Ekleme genişliği:

Ext.create('Ext.panel.Panel', { 
    width: 1300, 
    height: 700, 
    title: 'Table Layout', 
    layout: { 
     type: 'table', 
     columns: 3, 
     tdAttrs: { 
      width: 500, 
     } 
    }, 
    defaults: { 
     width: '95%' 
    }, 
    items: [ 
     // ... 
    ], 
    renderTo: Ext.getBody() 
}); 
İlgili konular