To solve my own issue (at least after testing so far)... 
 
 
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:common="ibs.sm.ui.common.*"
>
<mx:Script>
 
function setColumnSizes():Void
{
datagrid.getColumnAt(0).__width = datagrid.width * 25 / 100;
datagrid.getColumnAt(1).__width = datagrid.width * 50 / 100;
datagrid.getColumnAt(2).__width = datagrid.width * 25 / 100;
datagrid.getColumnAt(0).resizable = false;
datagrid.getColumnAt(1).resizable = false;
datagrid.getColumnAt(2).resizable = false;
 
doLater(this, "resizableTrue");
}
 
function resizableTrue():Void {
datagrid.getColumnAt(0).resizable = true;
datagrid.getColumnAt(1).resizable = true;
datagrid.getColumnAt(2).resizable = true;
}
</mx:Script>
<common:SMDataGrid id="datagrid" width="100%" resize="setColumnSizes()">
<common:columns>
<mx:Array>
<mx:DataGridColumn headerText="25%"/>
<mx:DataGridColumn headerText="50%"/>
<mx:DataGridColumn headerText="25%"/>
</mx:Array>
</common:columns>
</common:SMDataGrid>
</mx:Application>
 
This is big hack but seems to avoid the redraw nastiness.  But of course its using 'undocumented internals that may change
in future versions' :-)
 
 
  -----Original Message-----
From: Paul Frantz [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 13 April 2005 12:02
To: 'flexcoders@yahoogroups.com'
Subject: RE: [flexcoders] DataGrid column resizing

Thanks Manish.  I had to change the resize attribute to

resize="doLater(app, 'setColumnSizes')"

for it to work and it you can see it wrestling with flex for control of the widths when its drawing but its better than what I had :)

Any other ideas?

Cheers,

Paul

-----Original Message-----
From: Manish Jethani [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 13 April 2005 11:37
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] DataGrid column resizing

On 4/13/05, Paul Frantz <[EMAIL PROTECTED]> wrote:

>         <mx:DataGrid width="100%">
>             <mx:columns>
>                 <mx:Array>
>                                 <mx:DataGridColumn headerText="25%"
> width="{app.width * .25}"/>
>                                 <mx:DataGridColumn headerText="50%"
> width="{app.width * .50}"/>
>                                 <mx:DataGridColumn headerText="25%"
> width="{app.width * .25}"/>
>             </mx:Array>
>         </mx:columns>
>         </mx:DataGrid>

For some reason your DataGrid overrides the widths specified by you.
To get around this, set up a resize handler and reset the widths in
doLater():

               function setColumnSizes():Void
               {
                datagrid.getColumnAt(0).width = app.width * 25 / 100;
                datagrid.getColumnAt(1).width = app.width * 50 / 100;
                datagrid.getColumnAt(2).width = app.width * 25 / 100;
               }

       <mx:DataGrid width="100%" id="datagrid"
          resize="doLater(setColumnSizes)">

setColumnSizes() is called on the next frame after the DataGrid is resized.

--
[EMAIL PROTECTED]
http://manish.revise.org/


~~-------
This e-mail may contain confidential information. If you are not the intended recipient, please notify the sender immediately and delete this e-mail from your system. You must not disclose this e-mail to anyone without express permission from the sender. The contents of all e-mails sent to and received from Optus may be scanned, stored, or disclosed to others at Optus discretion.

Optus has exercised care to avoid errors in the information contained in this e-mail but does not warrant that the information is error or omission free. The information (including any pricing information) contained in this e-mail is subject to change. This e-mail is not a quotation or proposal and no contractual obligations arise until you and Optus sign a formal written contract or formal variation to your existing contract.

Any pricing contained in this e-mail is exclusive of GST unless otherwise stated.
********************************************************************


Yahoo! Groups Links

Reply via email to