I haven't time to redo your example - check out nested repeaters in the
docs.
Th ebasic problem is that your repeaters aren't tied to one another.
repeater 2 should be using repeater 1 as it's source, something like:
<mx:Repeater id="Repeater2" dataProvider="{repeater1.currentItem.article}">
Paul
----- Original Message -----
From: "ronny_koesnadi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 26, 2007 11:07 PM
Subject: [flexcoders] nested repeater from XML data
> Hi
> I am new to flex 2 and need help with a bit of nested repeater problem.
> I have an external xml data named "data.xml" as follow:
> <?xml version="1.0" encoding="UTF-8"?>
> <products>
> <product>
> <productno>p1</productno>
> <article>
> <articleno>a1</articleno>
> </article>
> <article>
> <articleno>a2</articleno>
> </article>
> </product>
> <product>
> <productno>p2</productno>
> <article>
> <articleno>a3</articleno>
> </article>
> </product>
> </products>
>
> And the .mxml code is as follow:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute">
> <mx:XML id="data" source="data.xml" />
> <mx:VBox>
> <mx:Repeater id="Repeater1" dataProvider="{data.product}">
> <mx:Label text="{Repeater1.currentItem.productno}" />
> <mx:Repeater id="Repeater2" dataProvider="{data.product.article}">
> <mx:Label text="{Repeater2.currentItem.articleno}" />
> </mx:Repeater>
> </mx:Repeater>
> </mx:VBox>
> </mx:Application>
>
> The problem with the output is the child article for each parent product
> is being repeated:
> p1
> a1
> a2
> a3
> p2
> a1
> a2
> a3
>
> But what I want is:
> p1
> a1
> a2
> p2
> a3
>
> Can anyone pls help as to what I did wrong?
>
> Thanks!!
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
>
>
>