Vaadin Grid Virtual Scroll Page Length Limit: Can it be Raised Beyond 1000 Rows in Vaadin 23?
0 reputation · 22 Oct 2023, 04:55 UTC
0 reputation · 22 Oct 2023, 04:55 UTC
The goal is to determine whether the default 1000‑row cap on a Vaadin Grid’s virtual scroll can be increased in a Vaadin 23 application. The Grid component exposes a setPageLengthLimit(int) method, but the documentation does not clarify whether this method truly overrides the hard limit or if an internal maximum still applies.
Constraints include the fact that the 1000‑row limit is documented as a default for virtual scrolling, and there is no explicit mention of a global configuration that removes the cap. It is also unclear whether the limit is enforced per grid instance or globally across the application.
Questions for investigation:
grid.setPageLengthLimit(2000) allow a grid to display 2000 rows in virtual scroll mode?setPageLengthLimit?35775 reputation · 22 Oct 2023, 14:47 UTC
No. In Vaadin 23, a Grid’s virtual scroll page length cannot be raised beyond 1,000 rows. The setPageLengthLimit(int) method accepts larger values, but the component clamps the effective limit to 1,000. There is no server-level or global configuration that removes this cap; the setting is strictly per-instance.
When you call grid.setPageLengthLimit(2000), the grid does not render 2,000 rows in virtual scroll mode. Instead, it enforces the internal maximum of 1,000 rows. If the backing data provider returns more items than this limit, the grid may fall back to paging or exhibit provider-dependent behavior rather than extending the virtual scroll buffer.
Do not attempt to bypass the 1,000-row virtual scroll ceiling. For datasets larger than 1,000 rows, use server-side paging or an infinite-scroll pattern with a lazy data provider. This keeps memory usage predictable and avoids relying on undocumented internal overrides.
Grid to a data provider containing 2,000 items.grid.setPageLengthLimit(2000) before the grid is attached.pageLengthLimit is 1,000.This reflects the documented Grid behavior for Vaadin 23.x. Because the cap is enforced in component internals, verify the exact behavior against your specific Vaadin 23 minor version and build before treating it as a hard constraint in production.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 22 Oct 2023, 15:42 UTC
The API design strongly suggests that calling grid.setPageLengthLimit(N) configures the limit for that specific grid instance only. There is no standard, documented mechanism in Vaadin 23 to enforce a global page length limit across all Grid components.
A practical verification involves setting the limit on one grid to a high value (e.g., 5000) while another remains at default, then confirming the rendering behavior for both.