PDA

View Full Version : column width gridpanel - auto width??



gurpal2000
23 Nov 2007, 2:26 PM
Hi i'm a newbie and struggling to find out how to do "autowidth" my columns in a gridpanel. Here's my code. Any advice? I've looked at loads of examples and forums and everyone seems to be specifying an explicit width. Thanks

var grid = new Ext.grid.GridPanel({

store: dataStore,
columns: [
{ header: 'Vendor', dataIndex: 'vendor' },
{ header: 'Application', dataIndex: 'application' }
],
loadMask : true
});

var viewport = new Ext.Viewport({
layout: 'border',
items: [{
region: 'center',
title: ''
},{
region: 'north',
title: '',
height: 50
},{
region: 'west',
title: 'Apps',
width: 250,
split: true,
items: [ grid ],
layout: 'fit'
}]
});

23 Nov 2007, 3:47 PM
The array grid (first example) shows you how to do this:


autoExpandColumn: 'company',

gurpal2000
23 Nov 2007, 4:02 PM
i saw that, but I can't seem to specify all the columns (or even by name)...
Thanks

23 Nov 2007, 6:32 PM
only one column can be autowidth.

gurpal2000
27 Nov 2007, 2:48 PM
only one column can be autowidth.

i see. Is there at least a way to have the gridpanel display with 100% width overall?
Much appreciated,

27 Nov 2007, 5:41 PM
yeah specify layout: 'fit' for the grid panel