Live column API
Query column objects and connect to current widths, order, and visibility.
Options
Changes below update the Grid and code immediately.
Drag the product header boundary in the table above. Inspect before/after widths in the columnResized result.
View code
Sample data included in the code · 6 rows
Usage guide
#Use column APIs when your app needs to read the current configuration after users resize or reorder columns. Distinguish column definitions from live column objects.
Integration steps
- Change a column in the view
Drag the product header boundary in the table above. Inspect before/after widths in the columnResized result.
- Query current column state
Click Read column state above the table to display widths, order, and pinning in the results. Change product width or pinning and query again to compare.
- Read serializable values separately
Call getColumnState() to save widths, order, and pinning. Store this state array rather than serializing live column objects.
Connect the current column configuration to your app through column events and API results.
Read column state calls getColumnState(). For live column objects, use getColumn('product') or getColumns(). A missing name may return null.
Useful terms
- field / colId
- A name used to find a column, such as product.
- Column object / column state
- A column object is a live Grid reference; column state is a collection of serializable values.
Key API examples
Application code that references the registered Grid element as grid.
const column = await grid.getColumn('product');
const columns = await grid.getColumns();
const savedColumns = await grid.getColumnState();
console.log(column, columns, savedColumns);API reference
#Methods4
| Method / Arguments | Return type | Description |
|---|---|---|
| columnId: string | Promise<GridColumnRef<GridData, TValue, unknown> | null> | Select a name to inspect its type contract. |
Promise<ReadonlyArray<GridColumnRef<GridData, unknown, unknown>>> | Select a name to inspect its type contract. | |
| groupId: string | Promise<GridColumnGroupRef<GridData, unknown> | null> | Select a name to inspect its type contract. |
Promise<ReadonlyArray<GridColumnGroupRef<GridData, unknown>>> | Select a name to inspect its type contract. |
Explore each feature
Learn when to use each feature and how to configure it. Each guide identifies live examples and features you connect in your app.