0 Replies Latest reply on May 22, 2007 6:32 AM by pgherveou

    Sort XmlListCollection

    pgherveou
      Hi there

      I need some help to sort my XmlListCollection.

      Here is the xml file where I load the data :




      <RetrieveProductsResult>
      <ProductList>
      <Product>
      <Codper>MAR07</Codper>
      <Codcur>USD</Codcur>
      </Product>
      <Product>
      <Codper>MAR08</Codper>
      <Codcur>EUR</Codcur>
      </Product>
      ...
      </RetrieveProductsResult>



      I load my XmlListCollectionwith with those lines :



      <mx:XML source="/data.xml" id="xmlData" />
      ...
      [Bindable] private var productList : XMLListCollection = new XMLListCollection();
      ...
      productList.source = xmlData..Product;




      I use this xmlcollection to feed comboBoxes. I have as many combo as nested child inside the <product> element
      So I have created IcollectionView for each dataprovider


      [Bindable] private var codPerList : ICollectionView = ICollectionView(productList);
      [Bindable] private var codcurList : ICollectionView = ICollectionView(productList);
      ...



      Now I would like to sort and filter those collectionView to delete duplicate elements and sort them in alpabetical order
      But I can't find the way to use the sortField to sort those item

      Thanks for your help

      Pierre