ado2000
(Giovanni Adobati)
March 12, 2019, 12:14pm
1
Hi,
I’m using a TreeDataProvider to populate a tree with data from Amazon S3,
I’m filtering in this way by treeDataProvider.setFilter, it makes a filter only on the first hierarchical level.
Is there a way to do a search in all the levels?
Thanks
Katri
(Katri Haapalinna)
March 12, 2019, 12:49pm
2
Hi,
The method works as documented (https://vaadin.com/docs/v8/framework/datamodel/datamodel-hierarchical.html ):
For TreeDataProvider, both the sorting and filtering API is the same as in ListDataProvider. Sorting and filtering are applied separately for each hierarchy level, meaning e.g. that for a node that has not passed the filter there are no children shown.
To get around this, you can make your own filtering method that takes into account the children’s contents. There’s an example implementation in this GitHub issue: https://github.com/vaadin/framework/issues/9933#issuecomment-466457099
ado2000
(Giovanni Adobati)
March 12, 2019, 12:51pm
3
Hi Katri,
thanks for the suggestion.
ado2000
(Giovanni Adobati)
March 13, 2019, 4:13pm
4
Hi Katri,
after applying you suggestion, the filter is perfect.
I have another strange situation:
After i apply the filter, then there are nodes that has non children.
When i click to open a node that has no children, the tree freezes.
Some hints ?
Thanks a lot.
Katri
(Katri Haapalinna)
March 18, 2019, 8:06am
5
Hi,
I think I found the problem: https://github.com/vaadin/framework/issues/10104 . There are some workarounds presented in that GitHub ticket as well as in this other ticket https://github.com/vaadin/framework/issues/8492 , although nothing seems to work for all. Hope this helps nonetheless!
-Katri