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
7/8/2024
CHF
73.73
2
Olivier
1/5/2025
AUD
110.86
3
Flavien
7/28/2024
AUD
417.6
4
Danail
1/10/2025
HKD
249.29
5
Alexandre
4/19/2024
CAD
901.13
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
12/14/2024
CHF
811.9
2
Olivier
2/13/2025
USD
681.94
3
Flavien
4/27/2024
BRL
453.43
4
Danail
11/9/2024
CAD
915.47
5
Alexandre
10/24/2024
EUR
474.7
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/20/2024
AUD
782.68
2
Olivier
8/12/2024
BRL
650.265
3
Flavien
10/29/2024
USD
2,583.462
4
Danail
11/12/2024
GBP
2,517.039
5
Alexandre
2/20/2025
TRY
104.129