PDA

View Full Version : Filtered Tree - Where are filtered items held?



bboyle18
25 Aug 2009, 3:38 PM
Hi,

I have filtered a Tree but I would like to know where the list of filtered items is held.
In the TreeStore I can still see all my ModelData items but I cannot see anywhere that holds the list of filtered ModelData items.

Perhaps there is no where the filter items are stored, but if so, how is it determined what filtered items to display on screen?

Can anybody point me in the right direction?

Thanks

Brian

Arno.Nyhm
26 Aug 2009, 5:34 AM
if you look in the java code of TreeStore then you see that this method gives you the filtered children:


http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/store/TreeStore.html#getChildren(M,%20boolean) (http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/store/TreeStore.html#getChildren%28M,%20boolean%29)

bboyle18
26 Aug 2009, 6:07 AM
Ok, thanks. I see how it does it now.
It doesnt give me exactly what I need though. For a TreeGrid it returns the parent of the filtered child and all the children that are at the same level as it.
What i'm really looking for is to return jsut one result.....the child I have filtered.
I think I might need to override some of the methods in TreeGrid to acheive this.

Thanks

Arno.Nyhm
26 Aug 2009, 6:31 AM
in a Store.java you have this:

protected List<M> filtered;


to get this you need to subclass your treestore to get this value.


EDIT: sorry. i see the Store#applyFilter overwrite this Store#applyFilter and you dont have a already filtered list like in store.

but you can call the method getAllItems and then check with this Store method if the item is filtered:
protected boolean isFiltered(ModelData record, String property)