use of com.vaadin.flow.component.combobox.test.service.PersonService in project flow-components by vaadin.
the class ComboBoxView method lazyLoading.
private void lazyLoading() {
ComboBox<Person> comboBox = new ComboBox<>();
PersonService service = new PersonService(500);
/*
* When provided a callback, the combo box doesn't load all items from
* backend to server memory right away. It will request only the data
* that is shown in its current view "window". The data is provided
* based on string filter, offset and limit.
*
* When the user scrolls to the end, combo box will automatically extend
* and fetch more items until the backend runs out of items.
*/
comboBox.setItems(query -> service.fetch(query.getFilter().orElse(null), query.getOffset(), query.getLimit()));
comboBox.setId("fetch-callback");
addCard("Lazy Loading", "Lazy Loading with Callback", comboBox);
}
Aggregations