View Full Version : Hide Gridpanel Header and Stretch Column?

22 Feb 2010, 11:47 AM
I have a gridpanel having only one column which is inside an accordion. I want to make that header invisible but all records. Along that I want to make that column to be stretched to the width of gridpanel as well.
I have tried doing these things but not very good result, here`s my config:

var routeGrid = new Ext.grid.GridPanel({
title: 'Route',
store: routeStore,
columns: [
{header: "Location", dataIndex: 'Location', resizeable: true, sortable: false, renderer: function(value,p,r){ return String.format("<b>{0}</b><br />{1}<br />{2}<br />{3}, {4}", value, r.data['Speed'], r.data['DateAndTime'], r.data['Latitude'], r.data['Longitude']); }}
viewConfig:{ forceFit: true }

Here is what I am getting from current work!

22 Feb 2010, 12:02 PM
You want the 'location' header hidden? have you tried the 'hideHeaders' config option in GridPanel?

For the column stretching, give your column an id and try the autoExpandColumn config option in GridPanel.

23 Feb 2010, 3:56 AM
Thanks, I tried the headers thingy and it worked.......
but autoExpandColumn is not working....I gave id to my Location column 'Loc' and gave autoExpandColumn: 'Loc' in config option.
But its not working

23 Feb 2010, 4:05 AM
If you look at the documentation (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.GridPanel) you'll see that autoExpandColumn is ignored if, as you have, forceFit set to true.

23 Feb 2010, 6:49 AM
I still cant find what you saying....I didnt find anything saying forceFit wont let autoExpandColumn work. Anyway, I tried removing forceFit but it didnt work too....Same result as shown in attached snapshot in previous post of mine!

23 Feb 2010, 7:03 AM
From the documentation (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.GridPanel):

autoExpandColumn : String

The id of a column in this grid that should expand to fill unused space. This value specified here can not be 0.

Note: If the Grid's view is configured with forceFit=true the autoExpandColumn is ignored. See Ext.grid.Column.width for additional details.

See autoExpandMax and autoExpandMin also.

Repost your updated code.

23 Feb 2010, 10:35 AM
Not working....
I did exactly what u suggested...but no sign of improvement. Even i cant see any change or difference before and now except for that hiding header stuff.

23 Feb 2010, 10:46 AM

Not working....

Repost your updated code. See http://www.extjs.com/learn/Ext_Forum_Help#Posting_a_working_showcase