1 Reply Latest reply on Oct 12, 2010 12:39 AM by BhaskerChari

    sort data collection

    ArrowUpRight

      Hello everyone!

      I have an ArrayCollection of valueObjects in use. I need to iterate trough them and put them into XML in alphabetical order.

       

      I use this function

       

              public function compileExportXML(data:ArrayCollection):XML {
                  var compXML:XML = <Root></Root>;
                  for each (var item:Object in data) {
                      var XMLItem:XML = <Item></Item>;
                      if (item.Type == 'Text') { XMLItem.appendChild(item.Text); }
                      if (item.Type == 'Module') {XMLItem.@href = 'file:///' + item.IDbus + '.indd'; }
                      compXML.appendChild(XMLItem);
                  }
              return compXML;           
              }

       

      This is the XML i retreive:

       

      <Root>
        <Item href="file:///10410001.indd"/>
        <Item>Placeholder text here</Item>
      </Root>

       

      But, how to place the compXML content in alphabetical order basing on the item's Rubric value of type text?

       

      Thanks in advance, Alex.