Similarly, since you are repeating a custom component, you could
implement a public property on the component to hold the index, using a
setter function.  Pass the repeater.currentIndex into the component via
that property, and have the setter function use the passed in index
retrieve the secondary value from wherever you want. 

 

If the secondary data source is not indexed, but rather keyed, like an
associative array or a dictionary, use the same idea.  Either pass in
the required key value from currentItem, or, as I advise, pass a
reference to the entire dataProvider item into the component, via a
setter.

 

Finally, depending on your data, you could use a hierarchical
dataProvider, like XML, or nested collections.  Pass the entire
currentItem into the component, and the child data will be available for
whatever you need.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Pearce
Sent: Thursday, August 28, 2008 1:57 AM
To: [email protected]
Subject: RE: [flexcoders] Repeater Component

 

Had a similar issue. The trick is to use {index of currentItem} and not
currentIndex, as currentIdex will fail when used with your secondary
data source.

 

Try this (just an example):

 

Assumes your have 

 

*       "dp1" -> your primary data source (collection)
*       "dp2" -> your secondary data source (collection)

 

<mx:Repeater id="theRepeater" dataProvider="{dp1}">

      <mx:Panel id="thePanel" label="{dp2.getItemAt(
dp1.getItemIndex(theRepeater.currentItem ) )}">

            <mx:Text text="{theRepeater.currentItem}" />

      </mx:Panel>

</mx:Repeater>

 

Hope that helps.

 

=) Mike

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jitendra jain
Sent: Thursday, August 28, 2008 1:30 PM
To: flex group flex
Subject: [flexcoders] Repeater Component

 

Hi friends,

   I have one repeater component that dynamically constructs a Check box
and two input boxes using a masterDataProvider(array collection). Now i
have another data provider childDataProvider(array collection). How can
i assign values of childDataProvider to repeater ?? Please help.

 

Thanks,

with Regards,
Jitendra Jain
Software Engineer
91-9979960798

 

 

 

Reply via email to