Virtualized React data grid

Virtualized React data grid for fast viewport rendering

A virtualized React data grid renders a moving window of rows and columns. Correct implementation depends on stable geometry, row identity, overscan, focus restoration, and measured cell cost.

Open virtualization documentation Read the performance guide

Start with stable geometry

Give the grid a bounded height and predictable row and column dimensions. Variable heights increase measurement and scroll-position complexity. Use stable row IDs so recycled DOM never changes record identity.

Tune overscan from interaction evidence

Too little overscan can expose blank regions during fast scroll; too much recreates the DOM cost virtualization is meant to avoid. Test trackpad, wheel, scrollbar drag, Page Down, and keyboard navigation on target hardware.

Profile the expensive path

Use browser performance tools to inspect scripting, style, layout, paint, memory, and React commits. Optimize custom cell renderers and data transforms before increasing buffers. Re-test editing and focus after each tuning change.

Keep focus and selection logical

Store active cell and selection by stable row and column identity rather than DOM references. When elements are recycled, restore focus intentionally and announce relevant state changes. Test selection ranges that cross unloaded or unrendered areas. Custom inputs, menus, and detail panels require additional focus rules because they may outlive the cell that opened them.

Assert data correctness after recycling

A virtualized grid reuses DOM nodes, so tests must prove that edits, selection, focus, and validation remain attached to the correct row after scrolling. Use stable row IDs in assertions. A grid that scrolls smoothly but edits the wrong record is a correctness failure, not a performance success.

Use performance budgets in regression tests

Define acceptable interaction thresholds for target browsers and hardware, store the dataset generator and renderer fixture, and compare releases with the same scripted tasks. Track both timing and correctness. A faster trace is not an improvement if focus, selection, or edit state becomes detached from the intended row.

Product evidence

Virtual rendering controls

GridVirtualProps exposes separate row, horizontal-column, and cell-content virtualization flags plus rowBufferPx and columnBufferPx.

Virtualized React data grid implementation

import { Grid } from "@ace-grid/core";

export function VirtualizedOrdersGrid({ rows, columns, loadMoreRows }) {
  return (
    <Grid
      data={{ rows, columns }}
      columns={{ columnWidths: {}, fillWidth: true }}
      layout={{ width: 1200, height: 600 }}
      virtual={{
        enableVirtualization: true,
        enableHorizontalVirtualization: true,
        enableCellContentVirtualization: true,
      }}
      scroll={{
        enableInfiniteScroll: true,
        infiniteScrollBatchSize: 100,
        loadMoreRows,
      }}
    />
  );
}

Limitations and tradeoffs

  • Do not virtualize a small grid without a measured rendering problem.
  • Do not use overscan tuning to hide unstable geometry, expensive transformations, or slow remote data access.

Common questions

What should a virtualization regression test assert?

Assert record identity, focus, selection, editing, pinned alignment, blanking, interaction latency, and mounted DOM under repeatable scrolling.

Should row and column buffers be maximized?

No. Larger buffers reduce blank edges but mount more work. Tune one direction at a time from measurements on target hardware.

Sources