Data grid collapse columns

1 Answer 216 Views
General Discussions Grid
Daniel
Top achievements
Rank 1
Iron
Iron
Daniel asked on 25 Jul 2022, 04:02 PM

Hi.

I was asked to give the user the option to expand or collapse the columns. For example: on the header of the "Department name" column there will be an icon that when you click on it will expand and display the 2 columns after it. The deductive approach is that they will be folded until the user clicks on the icon.

Is there a built-in function that does this? Otherwise, how can it be done?

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 26 Jul 2022, 11:26 AM

Hello, Daniel,

Currently, this functionality is not available out of the box, however, this can be achieved by toggling a flag variable in the state that will determine whether or not to render the nested columns.

Here is an example that showcases this approach:

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

 

As you will notice, the column's structure changes based on the expanded state of a particular header cell.

I hope this helps.

Regards, FilipProgress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Tags
General Discussions Grid
Asked by
Daniel
Top achievements
Rank 1
Iron
Iron
Answers by
Filip
Telerik team
Share this question
or