have you tried using the initialize event?

On 2/12/07, Paul Barbieux <[EMAIL PROTECTED]> wrote:

  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



--
http://indeegrumpee.spaces.live.com/

Reply via email to