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
12/25/2024
NZD
302.11
2
Olivier
8/21/2024
TRY
844.15
3
Flavien
8/21/2024
GBP
907.02
4
Danail
8/14/2024
GBP
571.44
5
Alexandre
9/2/2024
CAD
608.58
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
5/2/2024
CHF
447.86
2
Olivier
5/2/2024
JPY
909.21
3
Flavien
3/23/2025
JPY
594.24
4
Danail
5/20/2024
GBP
860.27
5
Alexandre
12/14/2024
NZD
939.13
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
10/20/2024
CHF
2,666.265
2
Olivier
5/21/2024
AUD
1,773.954
3
Flavien
1/14/2025
THB
1,062.779
4
Danail
2/16/2025
EUR
54.558
5
Alexandre
2/19/2025
AUD
1,299.638