Vaadin - Multiple filters for Tree table

I’m doing a project in Vaadin 7. In that I need to implement filters for a Treet able.

I was quiet successful in applying filters for one value. I mean, I have 4 Comboboxex ‘c1’, ‘c2’, ‘c3’, ‘c4’ and a Treetable ‘TT’. I load values to ‘TT’ using a HierarchicalContainer ‘HC’.

I implemented filters for all those Comboboxes using ValueChangeListener & addContainerFilter(). When I select a value from ‘C1’ it filters successfully and displays rows accordingly in the ‘TT’. Then, when I select a value from ‘c2’. It just ignores the filter set by ‘c1’ and filters value based on the value set at ‘c2’ and same in the rest of the filters.

All I need is, When I set value in both Comboboxex ‘C1’ & ‘C2’ the tree table ‘TT’ should display rows based on the values in both ‘c1’ & ‘c2’.

filterlogic  = C1 AND C2 (Correct)

filterlogic = C1 OR C2 (Wrong)

I tried a lot and I studied a lot of codes. But, can’t get it done. Any help appreciated.!

Hi,

if you’re using addContainerFilter() then the filters should work in the ‘and’ mode - that is, only items that pass all the filters should be shown. If this does not work, there’s a bug either in vaadin or your code. Could you provide a simple test case which demonstrates this behavior?

Also make sure that you’re not calling removeContainerFilter or removeAllContainerFilters at inappropriate locations, and note that resetting the container (via setContainerDataSource) destroys the filters also.