ColumnVirtualizationPlugin
Column Virtualization Plugin for tbw-grid
Provides horizontal column virtualization for grids with many columns (30+). Only renders visible columns plus overscan, significantly improving rendering performance for wide grids.
Installation
Section titled “Installation”import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';Requirements
Section titled “Requirements”- Grid must use
fitMode: 'fixed' - Columns must have explicit widths
- Grid must have fixed height
| Option | Type | Description |
|---|---|---|
autoEnable? | boolean | Auto-enable when column count exceeds threshold (default: true) |
threshold? | number | Column count threshold for auto-enabling (default: 30) |
overscan? | number | Extra columns to render on each side for smooth scrolling (default: 3) |
Example
Section titled “Example”Wide Grid with Column Virtualization
Section titled “Wide Grid with Column Virtualization”import '@toolbox-web/grid';import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';
grid.gridConfig = { columns: generateManyColumns(100), // 100 columns fitMode: 'fixed', // Required plugins: [ new ColumnVirtualizationPlugin({ threshold: 30, // Enable when >30 columns overscan: 3, // Render 3 extra columns each side }), ],};See Also
Section titled “See Also”ColumnVirtualizationConfigfor configuration options
Extends BaseGridPlugin
Inherited methods like
attach(),detach(),afterRender(), etc. are documented in the base class.
Methods
Section titled “Methods”getIsVirtualized()
Section titled “getIsVirtualized()”Check if column virtualization is currently active.
getIsVirtualized(): booleangetVisibleColumnRange()
Section titled “getVisibleColumnRange()”Get the current visible column range.
getVisibleColumnRange(): objectscrollToColumn()
Section titled “scrollToColumn()”Scroll the grid to bring a specific column into view.
scrollToColumn(columnIndex: number): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
columnIndex | number | Index of the column to scroll to |
getColumnOffset()
Section titled “getColumnOffset()”Get the left offset for a specific column.
getColumnOffset(columnIndex: number): numberParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
columnIndex | number | Index of the column |
getTotalWidth()
Section titled “getTotalWidth()”Get the total width of all columns.
getTotalWidth(): number
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt