This is a migrated thread and some comments may be shown as answers.

Expand One Grid Row Only at a Time with React

2 Answers 226 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raef
Top achievements
Rank 1
Raef asked on 06 Oct 2020, 05:48 PM

Hello

How to expand One Grid Row Only at a Time with React, the behavior needed is that all the rows will be collapsed when i expand a row.

I found a solution with jquery but not in React.

Thank you in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 07 Oct 2020, 11:56 AM

Hello, Raef,

The expanded state of the details is part of the data.

I can suggest on the onExpandChange event to set the expanded state to expanded on the currently clicked detail and set the expanded field to false to all other items.

I made an example showcasing this:

https://stackblitz.com/edit/react-fmmump?file=app/main.jsx

I hope this is helpful.

Regards,
Stefan
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Raef
Top achievements
Rank 1
answered on 09 Oct 2020, 05:02 AM
Thank you, this is exactly what i need.
Tags
General Discussions
Asked by
Raef
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Raef
Top achievements
Rank 1
Share this question
or