Data Grid - Row customization recipes
Advanced row customization recipes.
One expanded detail panel at a time
By default, the Master detail 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
1/24/2025
USD
22.16
2
Olivier
7/12/2024
NZD
239.97
3
Flavien
9/12/2024
ARS
95.06
4
Danail
3/28/2025
HKD
99.76
5
Alexandre
2/16/2025
JPY
772.89
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
1/4/2025
BRL
86.93
2
Olivier
12/1/2024
EUR
312.38
3
Flavien
7/8/2024
USD
38.45
4
Danail
2/14/2025
JPY
433.03
5
Alexandre
12/11/2024
THB
349.19
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
8/13/2024
EUR
1,529.682
2
Olivier
10/9/2024
CAD
471.692
3
Flavien
11/4/2024
HKD
784.707
4
Danail
5/16/2025
BRL
818.591
5
Alexandre
12/12/2024
NZD
3,642.922