PDA

View Full Version : Grid column autosize



zeroed
20 Feb 2009, 6:53 AM
I have a grid with the following data model:



this.columns = [
{header: "TypeId", width: 20, locked:true, sortable: false, dataIndex: 'typeId', hidden: true},
{header: "Item Type", width: 20, locked:true, sortable: false, dataIndex: 'itemType', hidden: true},
{header: "", width: 3, locked:true, sortable: false, dataIndex: 'descriptiveIcon', renderer: this._renderStateIcon},
{id:'type',header: "Type", width: 20, sortable: false, dataIndex: 'type', renderer: this._renderTypeName.createDelegate(this)},
{header: "Element", width: 20, sortable: false, dataIndex: 'element'},
{header: "Change", width: 20, sortable: false, dataIndex: 'change'},
{header: "New value", width: 20, sortable: false, dataIndex: 'newValue'},
{header: "Old value", width: 20, sortable: false, dataIndex: 'oldValue'},
{header: "Change description", width: 40, sortable: false, dataIndex: 'changeDescription'}
];


Is it possible to autosize "Item Type" column according to it's largest content?

Condor
20 Feb 2009, 6:58 AM
You could borrow some code from my dblclick-to-auto-size-column plugin (http://extjs.com/forum/showthread.php?p=272706#post272706).

zeroed
20 Feb 2009, 7:01 AM
Good, thanks a lot!