Data Grid - Row customization recipes
Advanced row customization recipes.
One expanded detail panel at a time
By default, the Master-detail row panel feature supports multiple expanded detail panels simultaneously.
However, you can control the expanded detail panels to have only one detail panel expanded at a time.
Order ID
Customer
Placed at
Currency
Total
1
Matheus
10/30/2024
HKD
11.91
2
Olivier
7/8/2024
CAD
808.9
3
Flavien
5/13/2025
THB
932.55
4
Danail
12/30/2024
AUD
779.83
5
Alexandre
4/3/2025
NZD
550.5
Expand or collapse all detail panels
The following demo shows how to create a custom header element that expands or collapses all detail panels at once.
Here's how it works:
The custom header uses gridRowsLookupSelector
to find all rows with a detail panel.
It checks the status of open panels using the useGridSelector
hook to access the grid's state.
When clicked, it uses setExpandedDetailPanels
from the Grid API to expand or collapse all detail panels.
Order ID
Customer
Placed at
Currency
Total
1
Matheus
7/22/2024
USD
662.35
2
Olivier
4/10/2025
ARS
84.23
3
Flavien
5/26/2025
USD
28.98
4
Danail
6/6/2025
CAD
547.26
5
Alexandre
3/24/2025
USD
529.32
Toggling detail panels on row click
In the demo below, you can toggle the detail panel by clicking anywhere on the row:
Order ID
Customer
Placed at
Currency
Total
1
Matheus
6/15/2024
THB
552.573
2
Olivier
2/15/2025
GBP
4,143.846
3
Flavien
8/13/2024
ARS
1,368.57
4
Danail
6/26/2024
CAD
3,344.933
5
Alexandre
6/20/2024
MXN
53.088