Pavlo
Pavlo

Reputation: 51

How to set width in Ext.grid.ColumnModel in percentage terms?

How to set width in Ext.grid.ColumnModel in percentage terms?

Upvotes: 4

Views: 9933

Answers (1)

Robby Pond
Robby Pond

Reputation: 73494

Use numbers for the column widths with a total of 100 and configure the view with forceFit, e.g.

var grid = new Ext.grid.GridPanel({
     cm: new Ext.grid.ColumnModel({
          columns: [{
              header: 'header1',
              dataIndex: 'data1',
              width: 30
          },{
              header: 'header2',
              dataIndex: 'data2',
              width: 30
         },{
              header: 'header3',
              dataIndex: 'data3',
              width: 40
         }]
     }),
     viewConfig: {
          forceFit: true
     }
});

Upvotes: 9

Related Questions