Dynamic Columns at Runtime
Columns can be added, removed and reordered at runtime by supplying new columnDefs. When column ids match, the grid preserves user-applied column state such as width, sort and pinning. This supports schemas that are only known at runtime.
Planned. This page shows the specification from issue #179. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
Columns for Jan-Mar plus a name column. The user can resize and sort columns.
Expected behavior
Extending the range appends month columns. Columns with an unchanged colId keep their width and sort. With maintainColumnOrder on, the order the user dragged is retained.
Planned API surface
columnDefscolumnDef.colIdapi.setColumnDefsmaintainColumnOrderonColumnsChangedapi.getColumnStateAcceptance criteria
- New columnDefs render without re-binding row data (pending)
- Column state persists for matching colIds (pending)
- Removed columns release their state and filters (pending)
- onColumnsChanged reports the added and removed colIds (pending)
- A headerName change alone updates the label without a state reset (pending)