Tree filtering

I have implemented an extended Ext.tree.View that provides proper filtering (hiding) of nodes and is extremely fast even on large trees. On my 3yo computer a tree of 1500+ nodes, nested up to 4 deep (maxExpandDepth:2), can be filtered in about 2 seconds.

The code is below. Use it in a treepanel with the param "viewType:'treefilteringview'"

You can create multiple filter components that will all be applied additively. So, for example, you could have a combo filter that filters on some category, and a text filter for general search within that selected category.

NB: This does not filter the TreeStore. Only the view is filtered.
NB2: Tree filtering is on the Extjs roadmap for an upcoming release so this extension may not be necessary in the long run.

2014-07-23 - Replaced begin/endBulkUpdate with the global and much more efficient Ext.suspend/resumeLayouts. The speedup is crazy awesome, but v4.1+ only.

Sorry I think you're confused. When I say it must implement filterFn I mean you must provide that function. I wasn't specifically talking about Ext.util.Filters though these should work with a little effort.

Also, "reset" isn't necessary despite what I said. It was in one version but I have since removed it.

Any suggestions on how to use this if we are filtering only leafs. For example, my leaf nodes have a name field, whereas the folders do not. I want the folders to dissapear if there are no unfiltered leafs in that folder. However, I would have to recurse into that folder first to know this... It seems like the code takes care of driving through the tree in applyFilter. However, in applyFilterFn, would I have to implement my filterFn such that it is recursive? I don't know if this will work performance wise, any ideas?