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
5/2/2025
CAD
550.73
2
Olivier
6/12/2024
CAD
301.55
3
Flavien
1/30/2025
CAD
844.14
4
Danail
2/21/2025
AUD
307.1
5
Alexandre
10/2/2024
HKD
692.98
MUI X Expired package version
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
6/7/2024
NZD
32.43
2
Olivier
9/14/2024
MXN
849.77
3
Flavien
10/28/2024
MXN
281.69
4
Danail
7/22/2024
AUD
365.65
5
Alexandre
6/23/2024
CHF
713.3
MUI X Expired package version
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/22/2024
JPY
4,401.548
2
Olivier
2/23/2025
GBP
5,194.928
3
Flavien
3/19/2025
AUD
2,740.185
4
Danail
10/25/2024
BRL
880.53
5
Alexandre
6/18/2024
AUD
1,707.09
MUI X Expired package version