0 Replies Latest reply on Jul 30, 2012 11:50 PM by megharajdeepak

    How to apply filterFunction to children?

    megharajdeepak Level 1


      I was working on filtering the XMLListCollection data based on certain criteria. It all works fine on the top level. But nothing seems to work on the subsequent child levels!



      myXMLListCollection =

      <row id="1" name="abcg" status="unchecked"/>

      <row id="2" name="abcd" status="checked">

           <row id="22" name="abcd" status="checked"/>

           <row id="23" name="abcd" status="unchecked">

           <row id="24" name="abcd" status="checked">

                <row id="241" name="abcdef" status="unchecked"/>

                <row id="242" name="ghijk" status="unchecked"/>

                <row id="243" name="lmnop" status="unchecked"/>


      <row id="3" name="abce" status="checked"/>

      <row id="4" name="abcf" status="unchecked"/>


      myXMLListCollection.filterFunction = myFunc;



      private function myFunc(item:Object):Boolean


           if(item.@status == 'checked')


                 return true;



                 return false;



      This gives me back only the rows with ids 2 and 3. And under the row having id as 2, it wont filter it's children nodes!


      Can you let me know how we can filter those child nodes as well? I came across few blogs which talked about recursive filtering, but not sure how to make it work...


      Appreciate your help..