I am having an issue when I attempt to reorder the columns in my kendo grid and save the state. I am able to get the column order saved after reordering and then reloaded correctly in the updated order, but the issue is that only the column headers are responding to the reorder not the column content especially when the column contains a columnTemplate. How do I ensure that when I reorder my columns, that the column content and column headers are both reordered, and my column content is not mismatched to an incorrect column header on reload or lost due to unexpected behavior. For context I am using this method to reset the column order after its saved and reloaded
reorderColumns(grid: kendo.ui.Grid, order: any) {
var columns = grid.columns;
for (var i = 0; i < order.length; i++) {
var field = order[i];
var currentIndex = -1;
var targetIndex = i;
for (var j = 0; j < columns.length; j++) {
if (columns[j].field === field) {
currentIndex = j;
break;
}
}
if (currentIndex !== -1 && currentIndex !== targetIndex) {
grid.reorderColumn(currentIndex, targetIndex);
}
}
}