New to KendoReact? Start a free 30-day trial
Implementing Single-Expand Mode for Detail Rows in KendoReact Grid
Updated on Mar 31, 2026
Environment
| Product | KendoReact Grid |
| Version | Current |
Description
The KendoReact Grid does not support a single-expand mode for detail rows out of the box. Single-expand mode ensures that expanding one row automatically collapses any previously expanded rows. Implementing this feature requires custom logic.
This knowledge base article also answers the following questions:
- How can I collapse all other rows when expanding one in the KendoReact Grid?
- How do I create single-expand functionality for Grid detail rows in KendoReact?
- Is it possible to manage detail row expansion programmatically in KendoReact Grid?
Solution
To implement single-expand mode for detail rows in the KendoReact Grid, follow these steps:
- Track the expanded state of detail rows using a state hook.
- Implement a method to identify and manage the expanded row.
- Use the
onExpandChangeevent of the Grid to update the expanded state.
tsx
function getNewOrChangedEntries(
oldObj: Record<string, any>,
newObj: Record<string, any>
) {
return Object.fromEntries(
Object.entries(newObj).filter(([key, value]) => oldObj[key] !== value)
);
}
const handleDetailExpandChange = (event: GridDetailExpandChangeEvent) => {
const diff = getNewOrChangedEntries(detailExpand, event.detailExpand);
setDetailExpand(diff);
};
Change Theme
Theme
Loading ...