0 Replies Latest reply on Jan 21, 2010 1:11 PM by FlexInATL

    Calling webservices inside a repeater


      Hi -


      I'm very new to Flex, so I'm probably doing something very, very stupid.  I'm trying to convert an existing Coldfusion web application to Flex in order to get my feet wet.  The page I'm working with has a UI based entirely on data.  The page has Topic Headers, Main documents, and Supporting documents.  Inside the CF app I'm making 3 different DB calls - once to retrieve topic headers, then a call inside that loop to find all Main Docs relating to that topic, and then a third to find all supporting docs related to a main document.  This happens for each topic header.


      I'm trying to dupicate this in Flex, so far with little success, by doing the following:


      1.) Call a webservice to retrieve my Topic Headers.  This works fine.

      2.) Use an <mx:repeater> to add Labels to the page with the Topic Headers.  Again, this works fine.  I have 4 Topic Labels all listed vertically.

      3.) Use the "repeat" attribute of the repeater to call another webservice to get my Main Document information.  This also works.

      4.) Nest another <mx:repeater> inside the first one, to show every Main Doc under the specified Topic Header.  This is where everything breaks down.


      I end up with 4 Topic Headers, but the document names under each Header are all the same.  It's like it only takes my last webservice call.  Code is below.  Am I approaching this in the wrong way?  Any help would be appreciated.




      <!-- Topic Headers Should Go Here. -->



      <mx:Repeater id="rep"

      dataProvider="{xmlResult.user}" repeat="wsmain.GetMainDocs.send(rep.currentItem.categoryid)">

           <mx:Canvas width="100%" backgroundColor="#eeeeee" borderStyle="solid" borderThickness="1"

                borderColor="#959696" cornerRadius="10">

           <!-- ** TOPIC HEADERS ** -->

                <mx:Label text="{rep.currentItem.categoryname}" width="100%" fontWeight="bold"

                     fontSize="14" textAlign="center" styleName="TopicHeader" />


           <!-- ** Main Docs Repeater -->



                    <mx:Repeater id="repmd" dataProvider="{xmlMainDocs.user}">

                          <mx:Label id="mdlabel" text="{repmd.currentItem.maindocorigname}" width="30%" fontWeight="bold"

                               fontSize="14" textAlign="center" />