The filterFunction only applies to the ArrayCollection. By hierarchy, I
assume you mean you have an ArrayCollection that contains ArrayCollections.
In other words, objects in your original ArrayCollection have, say, a
children ArrayCollection. In order to do what you're describing, you would
have to set the filterFunction on each of these child's filterFunction and
each of there's, etc.
In the past, I have done something like this to achieve what you're talking
about:
public function filterMenuItems(filter:IMenuFilter):void {
if (children) {
// need to clear all filters first, otherwise hidden higher
levels won't come back
children.filterFunction = null;
children.refresh();
for (var i:int=0; i < children.length; i++) {
if (children.getItemAt(i) is Menu) {
Menu(children.getItemAt(i)).filterMenuItems(filter);
}
}
children.filterFunction = filter.menuItemFilter;
children.refresh();
}
}
Here, a Menu is filtered by calling it's filterMenuItems method with a
filter object, traversing down through other Menu's children (via the
recursive call) setting the filterFunction.
Scott
On Mon, Jul 21, 2008 at 5:55 PM, Greg Hess <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a tree control who's data provider is an ArrayCollection
> holding a single File object I defined. The File object represents the
> root of a remote file system hierarchy that has children getter that
> supports the tree control and each child is rendered in the tree with
> an ItemRenderer.
>
> The tree control displays the File hierarchy well and it traverses the
> data providers children as expected. However, filter does not. I
> wanted to apply a filter to the data provider so only directory items
> are displayed. I specified the filterFunction and refresh the
> dataProvider but it only gets called on the first root node and not
> the data model hierarchy and each item that gets rendered in the tree.
>
> Should I have implemented a special interface so the tree or data
> provider can properly filter the object hierarchy?
>
> What am I doing wrong?
>
> Any help much appreciated.
>
> -Greg
>
>