How Virtualization Works
The grid uses CSS Grid for layout and implements row/column virtualization in JavaScript:- Row Virtualization: Only rows visible in the viewport (plus a small overscan buffer) are rendered to the DOM
- Column Virtualization: Only columns visible in the viewport (plus frozen columns) are rendered
- Dynamic Calculation: The grid calculates which rows and columns to render based on scroll position
- Overscan Buffer: Additional rows/columns are rendered just outside the viewport for smooth scrolling
Virtualization is enabled by default. The grid automatically handles viewport calculations and updates as you scroll.
Enabling/Disabling Virtualization
Virtualization is enabled by default, but you can disable it if needed:- Enabled (Default)
- Disabled
Performance Benefits
Large Dataset Performance
Large Dataset Performance
With virtualization enabled, the grid can efficiently handle:
- 100,000+ rows: Only visible rows are rendered
- 100+ columns: Only visible columns are calculated
- Smooth scrolling: Overscan buffer prevents layout thrashing
- Low memory usage: DOM nodes are reused as you scroll
Memory Usage
Memory Usage
Without virtualization, rendering 10,000 rows would create 10,000+ DOM nodes. With virtualization:
- Only ~20-30 rows are rendered at once (depending on viewport height)
- DOM nodes are recycled as you scroll
- Memory usage remains constant regardless of dataset size
Best Practices
When to Consider Disabling
- Very small datasets (< 50 rows)
- Need to print or export entire grid at once
- Using third-party tools that require all DOM elements
- Testing scenarios where you need to query all rows
How It Works Internally
The grid uses several hooks to calculate virtualization:Viewport Calculation
The grid calculates which rows to render based on:- Scroll Position: Current
scrollTopandscrollLeftvalues - Viewport Dimensions: Available width and height
- Row Heights: Fixed or dynamic row heights
- Overscan Buffer: Extra rows/columns for smooth scrolling
Dynamic Row Heights
Dynamic Row Heights
Virtualization works seamlessly with dynamic row heights:
When using a function for
rowHeight, heights are calculated upfront. For optimal performance with large datasets (1000+ rows), use memoization or a static function.Scroll Performance
The grid usesflushSync to ensure smooth scrolling:
Frozen Columns and Virtualization
Frozen columns are always rendered, even when column virtualization is enabled:API Reference
enableVirtualization
true
Description: Controls whether row and column virtualization is enabled. When true, only visible rows and columns are rendered. When false, all rows and columns are rendered.
Usage:
Disabling virtualization with large datasets (1000+ rows) may cause performance issues and should be avoided.
Related Features
- Frozen Columns - Columns that remain visible during horizontal scrolling
- Dynamic Row Heights - Variable row heights with virtualization
- Keyboard Navigation - Navigate efficiently through virtualized content