1 Reply Latest reply on Feb 8, 2007 7:39 AM by Pigg_Man

    Does anyone know how to filter all items in an XMLListCollection?

    Pigg_Man
      I have a tree with the following structure.
      <node>
      <node1>
      <node2>
      <node3 />
      <node4 />
      <node5 />
      </node2>
      </node1>
      </node>

      I need to be able to filter on node 3, 4 and 5 and then after the filter if they don't exist get rid of node 2 level and then do another filter function to check if node 2 level is there and if not.. then filter out node 1 level. Basically this is a bottom up filter. In Flas 2.0 I would filter out the base level by deleting nodes.. and then run through the next level and check if they had any children or not.. if they didn't then I would delete them.. and then I would repeat the step for the last level.
      Does anyone know how to do this without having to remove the items from the collection.. basically perform a filter rather then a delete. I know the filter function only returns the first element of the xml struct.. which is annoying. If anyone can help me out I would sure appreciate it?

      Thanks
        • 1. Re: Does anyone know how to filter all items in an XMLListCollection?
          Pigg_Man Level 1
          I guess the filtering on a tree only passes in the root nodes... This is hugely lame on Flex's part. I basically had to make my own functions to delete the nodes dynamically.
          Remember this only works on an array item which is dynamic.
          delete list ;

          To make this work I have a main TreeCollection... and from that I made a copy. Treecollection.copy() and deletes stuff from the copied struct. After the deletions were done I then assigned the copy to the MyTree.dataprovider = copy.