Restrict Column Reorder

1 Answer 892 Views
Grid
LJ
Top achievements
Rank 1
Iron
Iron
LJ asked on 20 Jul 2021, 03:26 PM

Is there a way to restrict column reorder?  

In general we would like users to reorder the column as they see fit for preference.  However, there are some scenarios where it becomes problematic to allow it.  Even it we disable a column for reorder, if other columns are reorderable it can still move columns which have it disabled. 

 

I'll give you a few examples of where restricting the reorder is helpful - columns meant for outside edge. 

- "Select" column is set to be 1st column in the grid.  It doesn't have reorder enabled, so a user can't move it directly.  However, other columns which are reorderable can be moved in front of the "Select" column making it 2,3,4th or whatever.  It would be great to prevent this to say the select is not reorderable it should remain 1st (reorder to in front of it off-limits).

- This would also be true for an action column that we made sticky on the far right side (last).  Its not reorderable and should remain last.

 

1 Answer, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 23 Jul 2021, 07:11 AM

Hello John,

The developer can handle the columnReorder event and prevent it conditionally based on the new index of the column that is being reordered (available in the event data), e.g.:

https://stackblitz.com/edit/angular-9hnpfj?file=app/app.component.ts

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

LJ
Top achievements
Rank 1
Iron
Iron
commented on 23 Jul 2021, 08:36 PM

This is great Dimiter! Very helpful!

A follow-up question to take it a step further......the example you show is preventing the re-order as requested but the UI prompts to the user for showing that the column can be dragged to those out of bounds position still exist (it shows the "+" icon instead of the "Prohibited" icon). Do you know if this is controllable as well? I hope I'm making sense.

Thanks again!
Tags
Grid
Asked by
LJ
Top achievements
Rank 1
Iron
Iron
Answers by
Dimiter Topalov
Telerik team
Share this question
or