After reordering adding new column is placed after the reordered column

1 Answer 183 Views
Grid
Salim
Top achievements
Rank 1
Salim asked on 17 Sep 2021, 07:11 AM | edited on 17 Sep 2021, 07:12 AM

Hello, 

We Have a dynamic grid columns,  and the user is allowed to add column to it, moreover we  have enabled the reordering feature. 

but whenever a user reorder a column and tries to add a new column, the newly added column is not placed at the last column, but right after the reordered column.

Here's a sample : https://angular-wwvczz.stackblitz.io/

So our business need is that when a user add a new column, the added column should be added as last column, unless user want to change it's position, he can reorder the columns again.

Note in the example that grid.columnList property is not returning the newly added column unless a reorder happens.

can you please advise how should I proceed to achieve this requirement

 

Thanks in advance

 

1 Answer, 1 is accepted

Sort by
0
Yanmario
Telerik team
answered on 21 Sep 2021, 11:54 AM

Hi Salim,

Thank you for the provided example.

The behavior is expected as the newly added column is with index 0 and it's placed in front of the column with index of 0. What can be done to achieve the desired requirement is to use the reorderColumn method as demonstrated in the following demo:

https://stackblitz.com/edit/angular-wwvczz-avclvi

or re-render the Grid component when adding a new column:

https://stackblitz.com/edit/angular-wwvczz-jxhlaq

My recommendation would be to use the reorderColumn method.

I hope this helps.

Regards,
Yanmario
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/.

Tags
Grid
Asked by
Salim
Top achievements
Rank 1
Answers by
Yanmario
Telerik team
Share this question
or