Gugan Mohan
Gugan Mohan

Reputation: 1645

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)

NOT

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.!

Upvotes: 3

Views: 1035

Answers (1)

bitguider
bitguider

Reputation: 575

I did same job in my project using vaadin 6, on each combobox "in valueChangeListener" you need to execute the query in which you have to pass the string getting from C1 , C2 etc, if its only C1 then pass empty string in other parameters which will represent C2,C3 etc.....it will work fine.

PS : use "like" in query instead of = to get desired output

Upvotes: 1

Related Questions