PDA

View Full Version : [OPEN] [2.0a1] auto-resize Grid-column problem (double-click)



lvanderree
30 Sep 2007, 3:17 PM
In Extjs1.1 you could automatically resize the columns of a grid by double-clicking on the right-edge (splitter) of a column-header, this does not work anymore in 2.0alpha.

I don't know if this is done on purpose, but I suppose not.

Besides no real problems yet, only enjoying the improvements! (besides the conversion of my code from 1.1)

lvanderree
30 Sep 2007, 3:57 PM
In Extjs1.1 the columns of a grid could automatically be sized with the config property autoSizeColumns, but this property does not seem to exist anymore.

However, it still is mentioned in: http://extjs.com/deploy/ext-2.0-alpha1/docs/#Ext.grid.GridPanel-configs

at maxRowsToMeasure : Boolean
If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of rows measured to get a columns size - defaults to 0 (all rows).

Is this property removed? Because it is not mentioned anymore as a property.
Or am I doing something wrong? Because it does not work anymore.

evant
30 Sep 2007, 4:25 PM
I believe autosize was removed in the new GridPanel can anyone confirm?

lvanderree
30 Sep 2007, 4:30 PM
found out that it is done with view, like:



this.grid = new Ext.grid.EditorGridPanel({
ds: this.ds,
cm: this.cm,
view: new Ext.grid.GridView({
forceFit: true,
autoFill: true
}),
.....


which probably is nicer, but a hint in the introduction of the grid would be nice... ;)

lvanderree
30 Sep 2007, 4:32 PM
By the way,

these two threads are two different things!

My second post is now solved I think, the documentation can be improved to make the new situation clear.

My first post however still is open and even though related to column-sized, completely different.

mystix
30 Sep 2007, 6:44 PM
My second post is now solved I think, the documentation can be improved to make the new situation clear.

could you add this to the 2.x doc bugs thread? that would help. thanks.

lvanderree
1 Oct 2007, 2:48 AM
Documentation bug is added to the doc bugs thread.

That leaves this thread open for the column-splitter double-click bug. (if that is a bug, and not a new on purpose missing feature...)

treejanitor
29 Oct 2007, 12:31 PM
Just wondering if double-clicking a splitter to size the column to fit is no longer supported in Extjs 2.0 or an actual bug.

Animal
30 Oct 2007, 12:22 AM
If you want to poke about to see which element in the GridView class to add a dblclick handler to, here is a column autosizing function you can add to the GridPanel:



autoSizeColumn: function(c) {
var w = this.view.getHeaderCell(c).firstChild.scrollWidth;
for (var i = 0, l = this.store.getCount(); i < l; i++) {
w = Math.max(w, this.view.getCell(i, c).firstChild.scrollWidth);
}
this.colModel.setColumnWidth(c, w);
return w;
}