As you change each column, the DG will try to adjust other columns so that they 
all fit on screen.  Setting horizontalScrollPolicy="on" is one way to prevent 
auto-resizing.  Another is to generate new DGColumns from the old ones, adjust 
the their widths and then set the .columns property once.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Manu 
Dhanda
Sent: Monday, September 01, 2008 7:24 AM
To: [email protected]
Subject: [flexcoders] DataGrid columnWidth at runtime


Hii,

Can anyone help me to get a solution for the above written problem.

I have a datagrid with 8 columns. And I want to increase it's column width
on the mouse click of that cell (and decrease the other column widths in the
same proportion).

First column I want to keep constant (of width 20). Rest I want to change.

Here is what I am doing:
public function cellResizer(e:ResizerEvent):void{
var _cellIndex:Number = e.myCellIndex;
for (var i:uint=1; i< this.columnCount; i++)
{
if(i == _cellIndex || i == 0) continue;
if (i != _cellIndex)
{
this.columns[i].width = this.columns[i].width - 50;
}
}
this.columns[_cellIndex].width = this.columns[_cellIndex].width + 300;
}

Now, as in the above function, I am getting the current cell and when I
click it, I got the cellwidth increased as well. But, then after that, rest
of the clicks will go totally uncontrolled, with varying widths.

Anyone, who can guide me in a right direction please.

Thanks,
Manu.
--
View this message in context: 
http://www.nabble.com/DataGrid-columnWidth-at-runtime-tp19255573p19255573.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to