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
4/21/2024
USD
371.7
2
Olivier
6/10/2024
NZD
817.35
3
Flavien
3/25/2025
GBP
836.62
4
Danail
4/5/2025
CHF
164.88
5
Alexandre
3/6/2025
EUR
254.28
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/21/2024
CHF
394.83
2
Olivier
5/10/2024
HKD
815.92
3
Flavien
7/6/2024
CHF
116.65
4
Danail
12/5/2024
CAD
134.46
5
Alexandre
2/14/2025
ARS
449.88
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/21/2024
CHF
1,523.508
2
Olivier
10/27/2024
HKD
1,474.494
3
Flavien
8/15/2024
MXN
32.162
4
Danail
6/17/2024
NZD
1,714.86
5
Alexandre
4/29/2024
EUR
2,708.811