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/7/2024
TRY
684.8
2
Olivier
12/29/2024
HKD
162.27
3
Flavien
1/21/2025
MXN
601.32
4
Danail
3/19/2024
EUR
392.92
5
Alexandre
10/10/2024
USD
173.04
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/15/2024
TRY
550.35
2
Olivier
8/7/2024
CHF
299.96
3
Flavien
11/11/2024
GBP
689.75
4
Danail
9/8/2024
THB
220.95
5
Alexandre
9/13/2024
CHF
151.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
10/23/2024
NZD
332.871
2
Olivier
5/31/2024
CHF
312.249
3
Flavien
12/30/2024
BRL
331.926
4
Danail
1/22/2025
HKD
4,046.742
5
Alexandre
10/25/2024
THB
1,923.642