hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Grid with unknown size

Open rkovarik opened this issue 2 years ago • 1 comments

Hello,

Grid lazy loading works well based on How to load paged data (lazy-load) in Vaadin.

As I don't know the total size (I'd need to iterate all items) of the data set:

  • I've tried to don't pass the optional parameter size of the GridDataProviderCallback
  • the data are fetched from the endpoint but the grid is empty.

Any idea what I might be doing wrong?

AFAIK this works well in Flow via LazyDataView.

Thanks in advance Roman

rkovarik avatar Mar 02 '22 06:03 rkovarik

For now I use

    async itemsProvider(
        params: GridDataProviderParams<any>,
        callback: GridDataProviderCallback<any>
    ) {
        ...
        let totalSize = params.page * params.pageSize + items.length + 1; //+1 -> workaround, produces extra empty row
        callback(items, totalSize);
    }

so when I scroll down, next batch is loaded.

rkovarik avatar Apr 20 '22 06:04 rkovarik