Thank you Steve: it works !
In fact the solution was very simple !...

Paul

--- In flexcoders@yahoogroups.com, "Steve Cox" <[EMAIL PROTECTED]> wrote:
>
> At your time of creationComplete the dataprovider probably isn't
> populated. Thus you want the rowcount to change when the dataprovider
> length changes.
>  
> Try binding the rowCount property of the dataprovider to the
> dataprovider like:
>  
> <mx:DataGrid id="DG" dataProvider="{myDataProvider}"
> rowCount="{myDataProvider.length}" />
>  
>  
>  
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Paul Barbieux
> Sent: 12 February 2007 14:30
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] DG.dataProvider.length returns 0 at
> creationComplete time
>  
> Hello;
> 
> I would like that the number of lines in my dataGrid is equal to the
> number of data from my dataProvider.
> 
> I have found a part of solution by searching in this forum, and the code
> is simple:
> 
> DG.rowCount = DG.dataProvider.length;
> 
> So, I have written this code like this:
> 
> <mx:DataGrid id="DG" dataProvider="{myDataProvider}"
> creationComplete="DG.rowCount=DG.dataProvider.length">
> 
> But it doesn't work: DG.dataProvider.length return 0.
> 
> I have tried with the callLater:
> 
> private function resizeDG():void {
>    var dataLength:String = DG.dataProvider.length;
>    DG.rowCount = DG.dataProvider.length;
> }
> <mx:DataGrid id="DG" dataProvider="{myDataProvider}"
> creationComplete="callLater(resizeDG);"
> 
> The problem remains...
> 
> I have placed the resizeDG function in the creationComplete of the main
> component... and the problem remains...
> 
> But, if I create a button that calls the resizeDG, yes!, my dataGrid
> grows to the correct number of lines !
> 
> Thus, my problem is: how to invoke my function when the dataGrid is
> displayed ?
> Why the creationComplete doesn't work ?...
> 
> Thank's
> 
> Paul
>


Reply via email to