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
11/15/2024
EUR
291.79
2
Olivier
5/28/2024
CAD
424.25
3
Flavien
3/15/2025
THB
157.54
4
Danail
3/23/2025
HKD
974.75
5
Alexandre
12/4/2024
CHF
52.09
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
7/24/2024
GBP
550.64
2
Olivier
6/1/2024
GBP
236.62
3
Flavien
10/9/2024
USD
216.23
4
Danail
4/7/2024
CAD
610.38
5
Alexandre
10/22/2024
EUR
109.96
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
12/27/2024
EUR
3,171
2
Olivier
5/23/2024
ARS
3,548.328
3
Flavien
1/1/2025
EUR
225.918
4
Danail
2/23/2025
THB
4,115.475
5
Alexandre
12/2/2024
HKD
350.648