2 Replies Latest reply on Sep 29, 2011 6:04 PM by pennsyfan

    How can i convert a arraycollection to an XmlList to put as a dataprovider for ADG

    Shravan P Level 1

      I have a arraycollection which i'm getting from backend.I need to convert it into XMLList with nodes, because i have to show the data like branches in ADG.

      now I'm using  grouping but getting lot of sorting issues. so i want to convert it into XmlList to show the data as it is.

      is there any way to handle this issue??

       

      Sample example can be appreciated.

        • 1. Re: How can i convert a arraycollection to an XmlList to put as a dataprovider for ADG
          Benoitcn Level 1

          loop your arraycollection and create your own xml.


          var arr:ArrayCollection = your arraycollection;
          var xml:XML = <Node/>;
          
          
          
          for each( var i:Object in arr ){
               xml.appendChild( <node name={i.name}> {i.value} </node> );
          
          }
          
          
          var xmlCLT = new XMLListCollection( xml..node );
          
          
          

          Or you can put some code in itemrenderer to analyze the data property, so you can use your arraycollection directly.

          • 2. Re: How can i convert a arraycollection to an XmlList to put as a dataprovider for ADG
            pennsyfan Level 1

            Hello,

             

            I am looking for some further information about this.

             

            I have an array collection of about 8 fields worth wide and say 200 rows deep and is dynamic.

             

            I need to take this cf query result and populate a tree control with the data.

             

            As I understand the above post, it will loop over only the first column in the query result set.

             

            How can I go about creating the children or level 2, level 3 etc

             

            Data structure would be something like this:

             

            caldate, Division, Batalion, Shift, Station, actCat, actionbyname, asstocode,

             

            The first is a datetime, while all others are char.

             

            Grouping should occur left to right in this order.

             

            Thanks

             

            Jim