I have a multi-row header grid (please see this example). When I set the caption option on Urban column using columnOption(), it sets the caption on the Country column.
JavaScript// app.component.ts
ngAfterViewInit() {
const grid = this.gridComponent.instance;
grid.option("columns", this.columns);
//debugger;
grid.columnOption("Population_Urban", "caption", "Urban Caption");
// at this point Country column's caption is "Urban Caption". i.e. grid.ciolumnOption() set the caption on the wrong column from this.columns.
grid.option("columns", this.columns);
// at this point the grid's Country column's caption is "Urban Caption", while Urban column's caption is still "Caption"
}
I thuink the problem is in ui.grid_core.columns_controller.js columnOptionCore() function:
JavaScriptcolumns = that.option("columns");
column = columns && columns[columnIndex];
columns is a tree structure while columnIndex is an index in the flattened collection of columns.