> Supply any data for childcomponents from a main component.

Thats a pretty good guiding principle for both component and
application development because it helps you to create loosely coupled
components. Even if Application.application.parameters.personID were
available to your component I would say its a bad idea to use it
because if anything changed or you wanted to put another copy of the
component elsewhere in your app you'd have to rework things.

For example's sake lets say your SiteList component is made up of a
DataGrid and a Panel that displays some summary data about what is
being displayed in the DG. I would construct that by creating a
public, bindable dataProvider property on SiteList, and then bind the
DG to that local dataProvider property. You could then also bind
labels or other subcomponents to things like dataProvider.length, etc.
Or if you needed to do more involved calculations you could make
dataProvider a setter and then assign label and other values when the
dataProvider is changed/set. Your SiteList could then have its
dataProvider set by anyone, anytime and its subcomponents are none the
wiser.

HTH,
Ben


--- In flexcoders@yahoogroups.com, Luke Vanderfluit
<[EMAIL PROTECTED]> wrote:
>
> Hi.
> 
> Im replying to my own post coz Ive worked out something...
> I should pass the dataProvider fo the datagrid in my component from the 
> main application (or some controller class).
> I guess this is the recommended way:
> That is. Supply any data for childcomponents from a main component.
> 
> Any suggestions or thoughts on this are welcome...
> 
> Kr.
> Luke.
> 
> 
> Luke Vanderfluit wrote:
> > Hi.
> >
> > Ive been reading up on the component life cycle.
> >
> > However the following problem I still cant solve.
> >
> > I have an main application component that gets passed a request 
> > parameter (personid) at runtime.
> > (Application.application.parameters.personid)
> >
> > I then have a component called 'sitelist' that builds a datagrid
based 
> > on a server request involving the personid, so the server request
relies 
> > on the personid being passed on.
> >
> > In my main app I am able to see the personid parameter on loading,
but 
> > in the sitelist component personid is null on loading.
> > It seems that the child component renders before the main app and 
> > therefore the parameter doesnt exist at the time that the child is
created.
> >
> > What is the recommended way of getting a runtime parameter in a 
> > subcomponent?
> > I appreciate any help.
> >
> > Kr.
> > Luke.
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
> >
> >
> >
> >
>


Reply via email to