Chris, did you find a solution for this problem?




--- In [email protected], "zenwarden" <[EMAIL PROTECTED]> wrote:
>
> Ignore the comment below. It is acceptable (at least in a hack) to
> always return true. 
> 
> Sadly, this code example is not working, but it has put me on the
> right trail. 
> 
> Thanks.
> 
> Chris 
> 
> --- In [email protected], "zenwarden" <cwarden@> wrote:
> >
> > How does this work? You are always returning true.
> > 
> > 
> > --- In [email protected], "dwischusen" <dwischusen@> wrote:
> > >
> > > Hi Chris,
> > > 
> > > Yes, if you want a filterFunction to work on hierarchical data then
> > > you will need to override refresh().  The following class is a
bit of
> > > a hack, but it does work:
> > > 
> > > 
> > > public class FilterCollection extends XMLListCollection
> > > {
> > >   public function FilterCollection(source:XMLList):void
> > >   {
> > >           super(source);
> > >   }
> > >   
> > >   override public function refresh():Boolean
> > >   {
> > >           this.localIndex = this.toArray();
> > >           
> > >           var copy:XMLListCollection = new
> > > XMLListCollection(XMLList(this.toXMLString()));
> > >           
> > >           doFilter(this.filterFunction, copy.children());
> > >           function doFilter(filterFunc:Function, items:XMLList):void
> > >           {
> > >                   var len:int = items.length();
> > >                   for (var i:int = len-1; i >= 0; i--)
> > >                   {
> > >                           var childList:XMLList = items[i].children();
> > >                           if (!filterFunc(items[i]))
> > >                           {
> > >                                   delete items[i];
> > >                           }
> > >                           if (childList.length() > 0)
> > >                           {
> > >                                   doFilter(filterFunc, childList);
> > >                           }
> > > 
> > >                   } 
> > >           }
> > >           
> > >           this.localIndex = copy.toArray();
> > >           return true;
> > >   }
> > > }
> > > 
> > > --- In [email protected], "zenwarden" <cwarden@> wrote:
> > > >
> > > > I have a type in the msg. below it should be Tree control not
IEEE.
> > > > 
> > > > 
> > > > --- In [email protected], "zenwarden" <cwarden@> wrote:
> > > > >
> > > > > Hi,
> > > > > 
> > > > > I have a IEEE control that I wish to make searchable. I found
> a good
> > > > > example of Filtering Data In Flex at the forta blog.
> > > > > See:
> > > >
> http://www.forta.com/blog/index.cfm/2006/7/13/Filtering-Data-In-Flex.
> > > > > 
> > > > > When I tried to apply this to a tree I found that the filter
> > function
> > > > > only iterates over the top level nodes of an XMLListCollection.
> > > > > 
> > > > > Does this mean I have to overwrite refresh() in
XMLListCollection?
> > > > > That's not a trivial task.
> > > > > 
> > > > > Does anyone have any suggestions or experience with this?
> > > > > 
> > > > > Chris
> > > > >
> > > >
> > >
> >
>


Reply via email to