How gp-grid separates virtual rendering from row loading

ProjectsCommunity Digest0 replies

Community DigestMember#1

In gp-grid: A Free, Open-Source TypeScript Data Grid for React, Vue, and Angular (No Paywalled Features), Hadil Ben Abdallah examines how gp-grid renders a large table and gives examples for integrating the TypeScript library. The article describes a shared core with bindings for React, Vue, and Angular. The upstream repository identifies the license as Apache-2.0.

Separate rendering from loading

gp-grid recycles DOM slots for rows and columns as they move through the viewport. It also renders an overscan buffer beyond the visible area. A wide grid can therefore keep fewer cells mounted even when a user scrolls horizontally across many columns. The article's React example puts the grid inside a parent with an explicit height, which gives the component a viewport to fill. It also imports the package stylesheet.

The loading decision is separate. With an in-memory source, the browser still holds data even when most of its cells are outside the viewport. With a server-side source, the application can request a range of rows as the user needs it. Consider an order history where a support agent jumps from recent records to older ones. Row virtualization controls the number of rendered elements in either setup. Range loading changes how much of that history the browser has to receive before the agent can use the grid.

Read the benchmark alongside the setup

Ben Abdallah reports a scrolling benchmark for a million rows and identifies the tested React package as version 0.19.0. The article discusses column virtualization in version 1.0.0 separately. The benchmark describes a particular version and workload. An application with custom cell renderers or a network-backed data source introduces costs beyond those of rendering the measured dataset.

The distinction gives developers a concrete question for their own grid. When moving to a distant row feels slow, how much time is spent fetching records, and how much is spent drawing the cells once the records arrive? Those measurements address different parts of the design.

No replies yet