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
8/25/2024
USD
385.72
2
Olivier
10/17/2024
CHF
547.95
3
Flavien
3/28/2025
EUR
163.33
4
Danail
11/16/2024
JPY
35.71
5
Alexandre
9/18/2024
MXN
820.84
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
11/21/2024
ARS
93.86
2
Olivier
1/24/2025
ARS
619.49
3
Flavien
6/29/2024
MXN
260.28
4
Danail
8/8/2024
BRL
679.23
5
Alexandre
8/25/2024
CAD
232.39
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
7/22/2024
BRL
817.971
2
Olivier
10/4/2024
AUD
3,059.07
3
Flavien
1/14/2025
GBP
136.941
4
Danail
2/2/2025
GBP
1,116.318
5
Alexandre
6/28/2024
NZD
831.695