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/22/2025
BRL
660.15
2
Olivier
7/10/2024
AUD
454.91
3
Flavien
12/7/2024
BRL
999.1
4
Danail
7/31/2024
MXN
734.17
5
Alexandre
1/27/2025
NZD
965.8
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/24/2024
CAD
548.66
2
Olivier
4/1/2025
USD
752.96
3
Flavien
10/1/2024
AUD
900.41
4
Danail
6/3/2024
EUR
951.94
5
Alexandre
2/5/2025
EUR
722.29
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/4/2024
CHF
306.968
2
Olivier
7/19/2024
CHF
573.668
3
Flavien
5/7/2024
BRL
350.805
4
Danail
6/9/2024
HKD
2,296.518
5
Alexandre
3/10/2025
TRY
904.239