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

React grid group collapsed default

1 Answer 859 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Veteran
Vikram asked on 02 Sep 2020, 06:29 AM

I am using react grid group feature. But it shows groups expanded by default.

I didn't found any way to show it collapsed by default.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Sep 2020, 12:17 PM

Hello, Vikram,

The expand/collapse state of the groups is part of the data and controlled by the value of the field set in the expandField prop:

https://www.telerik.com/kendo-react-ui/components/grid/api/GridProps/#toc-expandfield

If all groups have to be collapsed,  I can suggest to loop over the data and set the expanded field of all records to false. This is an example showcasing it:

https://stackblitz.com/edit/react-gmfcy6?file=app/main.js

As the groups can be nested on many levels, the example only covers the first level, but it can be done recursively to cover N number of group levels if needed.

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).

Tags
General Discussions
Asked by
Vikram
Top achievements
Rank 1
Veteran
Answers by
Stefan
Telerik team
Share this question
or