Thanks Stephen :)

It's ugly but it works ;)

Thanks a lot.


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Stephen Allison
Sent: 11 September 2007 10:37
To: [email protected]
Subject: Re: [flexcoders] RE: DataGridColumn width

Hello Alban,
I had a similar requirement and ended up catching the columnStretch  
event of the data grid and laying out inputs (labels for me) on a  
canvas in the handler for columnStretch.  I would hope there's a  
better way though.  It' a shame just binding to the column widths  
doesn't work.  You may want to catch updateComplete too if anything  
else can cause your columns to change width.

<mx:DataGrid id="dgAllData"
        columnStretch="arrangeTotals(dgAllData)"
        updateComplete="arrangeTotals(dgAllData)">

...snip...
</mx:DataGrid>

and then something along the lines of
private function arrangeTotals(grid:DataGrid):void {
        var cumulativeWidth:Number = 0;
        for each (var col:DataGridColumn in grid.columns) {
                // logic to layout your controls
                cumulativeWidth += col.width;
        }
}

This worked for me, though I admit it's not a very elegant solution.
Stephen

On 11 Sep 2007, at 09:06, Alban Soupper wrote:

>
> Sorry, the mail has been sent before I can complete it L
>
>
>
> ...
>
> <mx:HBox width="{dg.width}">
>
> <mx:TextInput id="filter1" ... width="{column1.width}"/>
>
>             ...
>
> </mx:HBox>
>
> ...
>
> <mx:DataGrid id="dg">
>
>             <mx:columns>
>
>                                     <mx:DataGridColumn id="column1"  
> headerText="c1"/>
>
>                                     ...
>
>             </mx:columns>
>
> </mx:DataGrid>
>
>
>
>
>
>
>
> This doesn't work!
>
> The text inputs have not the good size and they don't resize  
> themselves when the columns are resized.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links




************************************************************************************
This email and any attachments  transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient, any disclosure, copying, use, 
or distribution of the information included in this message and any attachments 
is strictly prohibited.
If you have received this email in error please notify the system manager at 
[EMAIL PROTECTED] or by reply e-mail and immediately and permanently delete 
this message and any attachments. Thank you.

************************************************************************************

Reply via email to