Vaadi 14 - Grid getFilteredItems

Hello everyone, please tell me is there any possibility to get filtered items from filtered grid (Vaadin 14)? On web a can not find any soluton.

No. You have to store the item yourself

What DataProvider are you using?

to get all items i use

I found topic about use ListDataProvider getFilter but that not working for me

How many items do you have in the grid?

and how do you filter?

i use to add textfield to header using code like this

sorry, i just simply use

above is preparing the fields and assigning it to grid

And how do you create the DataProvider?

i don’t create DataProvider, I just use grid.setItems(…)

with setItems you create a DataProvider :wink:

what do you pass in setItems?

list of objects which i wanted to show

and how do you filter? Sorry for my stupid asking but maybe you can post your code

i know it ;), we have an universal class (its to big to show) which implements SerializablePredicate and on implemented test method are checked all fields added as filter fields which is setted as filter.

I asking my question that i thought that there is simpley way to get only visible items on grid to perform on them calculations.

Or something which allow me filter on stream using filter assigned to grid. Because i know what i put into grid but i don’t now what show me grid.

List<Person> allPersons = repo.findAll();
GridListDataView<Person> gridDataView = grid.setItems(allPersons);

// Filter Persons younger 20 years
gridDataView.setFilter(p -> p.getAge() < 20);

List<Person> items = gridDataView.getItems();

setItems(...) is a void method on my site

Oh sorry you are using Vaadin 14!