Makes perfect sense. Thanks, Tim.
--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
>
> Yes, but your dataGrid is in a child of a viewStack. It won't be
> instantiated until yu change to that selectedIndex. You can use the
> viewStack's creationPolicy="all". But, that's not usually best
> practice. Better to just use binding. Instead of:
>
> reportProjects.dataProvider = rptProjects;
>
> do something like:
>
> <mx:DataGrid dataProvider="{ rptReports }"/>
>
> Assuming that rptReports is an ArrayCollection, this will wait until the
> DataGrid is instantiated before setting the dataProvider.
>
> -TH
>
> --- In [email protected], "Steve Brownlee"
> <steven.brownlee@> wrote:
> >
> > When attempting to assign a dataProvider to a DataGrid...
> > reportProjects.dataProvider = rptProjects;
> >
> > I get the following error...
> > Cannot access a property or method of a null object reference.
> >
> > The only difference between this DataGrid, and one that is properly
> > instantiated is that its on a Canvas that's not visible when the
> > application starts. The statement happens after creationComplete,
> which
> > I thought was the event that got fired after all objects were created.
> >
> > creationComplete() > initApp() > loadProjects() > {problem statement}
> >
> >
> > Condensed version of design
> >
> > <mx:ViewStack>
> > <mx:Canvas label="Data">
> > ...
> > </mx:Canvas>
> > <mx:Canvas label="Reports">
> > ...
> > <mx:DataGrid id="reportProjects">
> > ...
> > </mx:DataGrid>
> > </mx:Canvas>
> > </mx:ViewStack
> >
> >
> > I can't figure out why this DataGrid isn't getting instantiated, or
> how
> > to ensure it does. Any help is greatly appreciated.
> >
> > - Steve
> >
>