Home/Columns/Resize & Reorder
Columns

Resize & Reorder

Drag the right edge of any column header to resize it. Drag a column header to reorder columns. Both features require opt-in per column.

#
First Name
Last Name
Email
Department
Salary ($)
Start Date
Status
1
Alice
Smith
alice.smith0@acme.com
Engineering
40000
2015-01-01
Inactive
2
Bob
Smith
bob.smith1@acme.com
Marketing
41000
2016-02-02
Active
3
Carol
Smith
carol.smith2@acme.com
Sales
42000
2017-03-03
Active
4
David
Smith
david.smith3@acme.com
HR
43000
2018-04-04
Active
5
Emma
Smith
emma.smith4@acme.com
Finance
44000
2019-05-05
Active
6
Frank
Smith
frank.smith5@acme.com
Operations
45000
2020-06-06
Active
7
Grace
Smith
grace.smith6@acme.com
Design
46000
2021-07-07
Active
8
Henry
Smith
henry.smith7@acme.com
Legal
47000
2022-08-08
Inactive
9
Iris
Smith
iris.smith8@acme.com
Product
48000
2023-09-09
Active
10
Jack
Smith
jack.smith9@acme.com
Support
49000
2024-10-10
Active
11
Kate
Smith
kate.smith10@acme.com
Engineering
50000
2015-11-11
Active
12
Liam
Smith
liam.smith11@acme.com
Marketing
51000
2016-12-12
Active
13
Mia
Smith
mia.smith12@acme.com
Sales
52000
2017-01-13
Active
14
Noah
Smith
noah.smith13@acme.com
HR
53000
2018-02-14
Active
15
Olivia
Smith
olivia.smith14@acme.com
Finance
54000
2019-03-15
Inactive
16
Paul
Smith
paul.smith15@acme.com
Operations
55000
2020-04-16
Active
17
Quinn
Smith
quinn.smith16@acme.com
Design
56000
2021-05-17
Active
18
Rachel
Smith
rachel.smith17@acme.com
Legal
57000
2022-06-18
Active
19
Sam
Smith
sam.smith18@acme.com
Product
58000
2023-07-19
Active
20
Tara
Smith
tara.smith19@acme.com
Support
59000
2024-08-20
Active
20 / 500 records

Two-level opt-in

Both features require enabling at two levels: globally in config and per-column in the column definition. Setting config.columnResize: true without column.resizable: true (or vice versa) has no effect on that column. This lets you mix resizable and fixed columns in the same grid.

Column resize

A drag handle appears at the right edge of resizable header cells. While dragging, (columnResized) fires continuously with { key, newWidth, prevWidth, final: false }. The final event (on mouse-up) has final: true — that's when you'd persist the width.

Resizing a flex column converts it to a fixed width automatically, so the column stays at the size you dragged it to.

Double-click to auto-fit

Double-click a column's right border to auto-size that one column to its content — the same gesture you know from spreadsheets. It fits the header text and the loaded data cells, works whatever autoSizeStrategy is (or isn't) configured, and honours suppressAutoSize. Prefer to do it in code? Call grid.autoSizeColumn(key) for one column, or grid.autoSizeColumns() for all of them. With virtual scrolling, auto-fit measures the rows currently loaded (the same as the programmatic API).

Column reorder

Drag a column header left or right to reorder it. The other columns animate into their new positions as you drop.

(columnReordered) emits { fromKey, toKey, insertSide } after the drop. If you're persisting column order, save on this event.

Persisting layout

Set persistColumns in config to remember column widths and order across sessions automatically. The example code uses mode: 'local-storage' with a stable key. For multi-user or cross-device persistence, use mode: 'server' with save() and load() functions that hit your API. See Grid State for details.

Mouse interactions

InteractionEffect
Drag right edge of a headerResize the column — (columnResized) streams with final: false, then final: true on release
Double-click a header's right edgeAuto-size that column to fit its content (header + loaded cells) — same as grid.autoSizeColumn(key)
Drag a header cell left/rightReorder the column — neighbours animate into place, (columnReordered) fires on drop
Drag a flex column's edgeConverts it to fixed width at the dragged size

Persist widths on the final: true resize event only — the drag streams intermediate events continuously, and saving each one would hammer storage or your API.

Resize & reorder options

PropertyTypeDefaultDescription
config.columnResizebooleanfalseGlobal switch — must be combined with column.resizable: true per column.
config.columnReorderbooleanfalseGlobal switch — must be combined with column.draggable: true per column.
column.resizablebooleanfalseShows the drag handle at the right edge of this header cell. Double-clicking that edge auto-fits the column.
grid.autoSizeColumn(key)method—Auto-size one column to fit content (what a double-click calls). autoSizeColumns() does all columns.
column.draggablebooleanfalseMakes this header cell draggable for reordering.
(columnResized)ColumnResizeEvent—Emits { key, newWidth, prevWidth, final } — continuous during drag, final: true on release.
(columnReordered)ColumnReorderEvent—Emits { fromKey, toKey, insertSide } after a drop.
config.persistColumns{ mode: 'local-storage' | 'session-storage' | 'server', key, save?, load? }—Automatic persistence of column widths and order across sessions.