i use Grid with DataProvider and lazy loading to load the data into the grid.
How can i get the data from grid after the data was loaded? I mean, i need get a data from grid that already have a data.
i need something like grid.get....
thx.
i use Grid with DataProvider and lazy loading to load the data into the grid.
How can i get the data from grid after the data was loaded? I mean, i need get a data from grid that already have a data.
i need something like grid.get....
thx.
I would use grid.getDataCommunicator().fetchFromProvider(..) which returns stream of items method for this, see API spec here: https://demo.vaadin.com/javadoc/com.vaadin/vaadin-core/10.0.2/com/vaadin/flow/data/provider/DataCommunicator.html#fetchFromProvider-int-int-
Since Vaadin 17, you can use DataView
API to get currently shown item/items in the Grid
:
GridDataView<Person> dataView = grid.getGenericDataView();
Person item = dataView.getItem(42);
// or get all shown items
dataView.getItems().forEach(item -> export(item));
Here is an example how to collect the data for export: https://vaadin.com/docs/latest/flow/binding-data/data-provider/#accessing-currently-shown-items