0 Replies Latest reply on Jan 17, 2008 6:57 AM by shawnyale

    Trying to sort XMLListcollection by attribute

    shawnyale Level 1
      I have a nested xml document in e4x that is retrieved from a web service. The document looks similar to the following:

      <node id="1" color="blue">
      <node id="2" color="green">
      <node id="3" color="purple"/>

      My code to sort looks like this:

      var treeSort:Sort = new Sort();
      treeSort.fields = [new SortField("@id", true)];
      dataSource_Tree.sort = treeSort;

      Sometimes my XML comes back with color in front of id and sometimes vice versa. But when I apply the sort, there is no difference in the order of the attributes, nor has any changes been made to the XMLListcollection. I have tried everything. Is there a problem applying the sort to nested xml in e4x?