How to set width in Ext.grid.ColumnModel
in percentage terms?
Asked
Active
Viewed 9,840 times
4

Narendra Jadhav
- 10,052
- 15
- 33
- 44

Pavlo
- 51
- 1
- 3
1 Answers
9
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
}
});

Robby Pond
- 73,164
- 16
- 126
- 119
-
1If you're not going to change the column definitions you might be better off using `viewConfig: { autoFill: true }` instead, see [sencha 3 docs](http://extjs.cachefly.net/ext-3.2.0/docs/) – Mark Rhodes Jul 06 '11 at 12:23