View as Markdown

Column Resize, Reorder, Chooser, Menu

Column menu

A per-header menu with built-in sort, filter, group, auto-size, pin and chooser items, custom items and submenus, per-column items and keyboard access.

columnMenu adds a menu button to every header. A column opts out with menu: false.

Items

columnMenu={true} shows the default menu. An array lists the items in order: built-in ids and custom DataGridMenuItem objects. autoSizeAll fits every visible column to its header and rendered cells in one step, like api.autoSizeColumns() with no argument.

Id Action
autoSizeAll, autoSize Fit every column, or this column, to its content; autoSize needs a resizable column (grid resizable)
group, ungroup Group or ungroup by this column (needs grouping)
sortAscending, sortDescending, clearSort Sort this column (needs sorting); clearSort is a Salmon UI addition
filter Open this column's filter menu (needs filtering)
columnChooser Open the column chooser
pinStart, pinEnd, unpin Pin or unpin this column (Salmon UI addition)

Built-in items that do not apply are left out (no sort items on a column that cannot sort, no group items without grouping), and the item that matches the current state, such as Sort ascending on an ascending column, is disabled.

A custom item has an id, a label and optionally an icon, disabled with a disabledReason tooltip, checked (rendered as a menu checkbox), href to render a link, render for custom content, separator: true, or nested items for a submenu.

Events

onBeforeColumnMenuOpen receives the column and a mutable copy of its items: edit event.items in place (splice, push, assign by index) to hide, add or update items for that column; the event object is frozen in development, so never reassign event.items. Call preventDefault() to keep the menu closed. onBeforeColumnMenuClose can keep it open. onColumnMenuItemClick reports every built-in and custom item with the column; preventDefault() skips the built-in action. renderColumnMenu replaces the menu and receives the resolved items, the default menu element and close().

Keyboard

On a focused header, Shift+Alt+ArrowDown opens the menu (Alt+ArrowDown too, when the column has no filter button). Arrow keys move between items, ArrowRight and ArrowLeft open and close submenus, and Escape closes the menu and returns focus to the header.

Column menu

Open demo

The header menu with every built-in item (sort, clear sort, filter, group, auto-size, pin, column chooser) in a custom order, a checkbox item and a submenu, per-column items through onBeforeColumnMenuOpen, column.menu: false, and onColumnMenuItemClick.

Drag a column header here to group by that column
Order
Customer
Country
Category
Priority
Amount
Placed
ORD-10000
Jun Park
France
Tea
Normal
$108.38
Oct 10, 2026
ORD-10001
Bao Nguyen
Germany
Equipment
Normal
$767.55
Jan 17, 2026
ORD-10002
Dewi Lestari
France
Tea
Low
$87.88
May 28, 2026
ORD-10003
Goran Petrov
Malaysia
Equipment
High
$245.10
Jun 28, 2026
ORD-10004
Hana Sato
Japan
Coffee
High
$16.65
Apr 12, 2026
ORD-10005
Farah Aziz
Japan
Coffee
High
$28.00
May 7, 2026
ORD-10006
Goran Petrov
Germany
Tea
Normal
$126.23
Jul 24, 2026
ORD-10007
Dewi Lestari
Malaysia
Equipment
Normal
$122.55
Dec 18, 2026
ORD-10008
Aiko Tan
Japan
Coffee
High
$142.80
May 8, 2026
ORD-10009
Aiko Tan
Malaysia
Equipment
Normal
$184.97
Sep 26, 2026
ORD-10010
Farah Aziz
Germany
Coffee
High
$158.17
Apr 7, 2026
ORD-10011
Bao Nguyen
Japan
Coffee
Normal
$59.50
Nov 9, 2026
ORD-10012
Farah Aziz
Portugal
Tea
Low
$109.01
Feb 5, 2026
ORD-10013
Dewi Lestari
Germany
Equipment
Normal
$778.80
Dec 13, 2026
ORD-10014
Aiko Tan
France
Equipment
Normal
$61.66
Apr 27, 2026
ORD-10015
Dewi Lestari
Malaysia
Equipment
High
$415.80
Aug 19, 2026
ORD-10016
Farah Aziz
Malaysia
Tea
Normal
$25.50
Feb 16, 2026
ORD-10017
Ines Duarte
Portugal
Tea
High
$70.76
Jul 20, 2026
ORD-10018
Chen Wei
Portugal
Tea
Low
$15.73
Jun 23, 2026
ORD-10019
Goran Petrov
Malaysia
Equipment
Low
$319.20
Sep 7, 2026
No events yet.

API reference

DataGridColumnMenuItemId lists the built-in ids and DataGridMenuItem the custom item fields; DataGridColumnMenuOpenEvent, DataGridColumnMenuItemClickEvent and DataGridColumnMenuContext are the event and render payloads.