I need to apply user settings on IgxGrid. What I am trying is that whenever a user reorders columns, I am saving the column indices in my database and next time when the user opens the same grid; I need to show the same settings on grid which he saved previously. But when I try to set the column index it says that there is no setter for index property. How can I achieve the functionality to change column indices dynamically? Here is what i am trying to do,
for (var iterator = 0; iterator < gridSettings.ColumnSettings.length; iterator++) {
if (this.componentRef.columns != null) {
for (let colIndex = 0; colIndex < this.componentRef.columns.length; colIndex++) {
if (this.componentRef.columns[colIndex].field == gridSettings.ColumnSettings[iterator].Key) {
this.componentRef.columns[colIndex].width = gridSettings.ColumnSettings[iterator].Width;
this.componentRef.columns[colIndex].index = gridSettings.ColumnSettings[iterator].Index;
break;
}
}
}
Here is the error which I am encountring,
ERROR Error: Uncaught (in promise): TypeError: Cannot set property index of [object Object] which has only a getter TypeError: Cannot set property index of [object Object] which has only a getter