Column reorder
Pass withColumnReorder to useDataGrid to let users reorder columns by dragging column headers.
Use columnOrder and onColumnOrderChange for controlled state.
- A column can be moved only within its pin region and its header group, utility columns always stay first
- With
withColumnMenu, the Move left and Move right menu items reorder columns from the keyboard - Grouped columns stay first while rows are grouped, see groupedColumnMode
Drag column headers to reorder
Header groups
Use the columns property of a column definition to group columns under a shared header.
Group headers can be resized, but cannot be sorted or dragged:
Column alignment
Set meta.align on a column to align its header, body and footer cells.
Columns with align: 'end' use tabular figures, use it for numbers:
Utility columns
Row reorder, row selection, row expansion and row numbers features add their own columns
at the start of the grid. Utility columns cannot be sorted, filtered, resized or hidden by the user
and are not exported. If your code iterates over table.getAllColumns(), skip columns with meta.utility.
Cell spanning
Set spanRows: true on a column definition to merge cells of adjacent rows that have
the same value in that column:
Pass a function instead of true to decide whether a row joins the run anchored at anchorRow:
Use spanColumns to make a cell span several columns. Return 1 for no span
or Infinity to span the rest of the row:
nullandundefinedvalues are not mergedspanRowsandspanColumnsare ignored whenvirtualizeis set- Set
enableCellSpanning: falseintableOptionsto disable spanning for the whole grid, or on a column definition to disable it for one column
Related pages
- Column sizing -- resize, min/max constraints
- Column visibility -- show/hide columns
- Pinning -- pin columns and rows
- Customization -- column menu