question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grid initially loads more than page size number of items when configured to lazy load

See original GitHub issue

Description of the bug / feature

I’m looking to implement lazy load to a grid with a custom backend data provider. I’m trying to load ~5 rows initially (total item count is 33 from the backend)

grid.setPageSize(5);
grid.setDataProvider(dataProvider);

However it seems like the data provider would just return all 33 (default limit is 50 according to what I read from the docs?) because the grid has determined that there’s a scroll bar so it could load up to 50 items? This comment on stackoverflow describes what I think I’m experiencing

Versions:

- Vaadin / Flow version: 14.4.10
- Java version: 11

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
miguelatvaadincommented, Apr 21, 2021

Hi @fionnachan,

I’ve been told that there are plans to change this behavior, so you will be able to change the minimum rows that the grid needs to load.

I have opened a new issue in the grid component repository (https://github.com/vaadin/vaadin-grid/issues/2166), so you can follow up it from there.

Thanks and best regards

0reactions
fionnachancommented, Apr 21, 2021

Thanks for the reply @miguelatvaadin. In my case, because I have several component columns, preloading 25 rows is enough to slow down the page load. Is there any way to get around this to reduce the number of preloaded items?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grid with lazy loading: very high number of calls into the data ...
To reduce the number of requests, the logic always fetches at least one page of items at the same time. The default page...
Read more >
Configuring Lazy Loading for WordPress with W3 Total Cache
It is implemented by the browser rather than a plugin. You can and likely should still use Lazy Loading through the W3 Total...
Read more >
Vaadin Grid Lazy Loading Issue - Stack Overflow
With this page size my experience is that Grid is fetching 50 - 100 items at the time in cases like yours (~25-30...
Read more >
JavaScript Grid: Infinite Row Model
Infinite scrolling allows the grid to lazy-load rows from the server depending on what the scroll position is of the grid.
Read more >
Make Webpages Load Faster with Lazy Loading - Infinum
Lazy loading is a technique that defers the loading of non-critical resources during the page load time. Instead, these non-critical resources ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found