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

Column reorder only within group

2 Answers 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Maurice
Top achievements
Rank 1
Maurice asked on 23 Aug 2018, 01:00 AM

Is it easily possible to allow column reordering, but then restrict columns within groups to only be reordered within that group?

Similarly, columns not in a group cannot be moved into a group - where both situations at the moment allow the group to be split into two groups of the same name each with a subset of the group's columns.

 

Thanks,
Maurice

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 27 Aug 2018, 10:28 AM
Hello Maurice,

You can handle the ColumnReordering event of RadGridView. The ColumnReorderingEventArgs give you the  NewDisplayIndex of the dragged column. Also you have e.Column.DisplayIndex - the current index of the dragged column. Having the Column and ColumnGroups properties of the RadGridView you can do the following:

- determine the maximum and minimum index for every group
        - check if the new index is outside the [min;max] boundary of he group
- set e.Cancel = true if drag is outside the range

I hope this approach fits well in your scenario.

Regards,
Petar Mladenov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Maurice
Top achievements
Rank 1
answered on 28 Aug 2018, 07:09 AM

Petar, that is the approach I took.

 

Regards,
Maurice

Tags
GridView
Asked by
Maurice
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Maurice
Top achievements
Rank 1
Share this question
or