Returning GridColumns by Index

When a GridColumn is returned by index, it contains a null reference to the corresponding DataFrame’s column. There is no issue, however, when the GridColumn is returned by name. Please see the code below.

let t = DG.DataFrame.fromColumns([
DG.Column.fromList(‘int’, ‘int’, [1, 2, 3]),
DG.Column.fromList(‘double’, ‘double’, [1.1, 2.1, 3.1]),
DG.Column.fromList(‘string’, ‘string’, [“a”, “b”, “c”])
]);

    let view = grok.shell.addTableView(t);
          
    let columnGrid = view.grid.columns.byName("int");
    let columnFrame = columnGrid.column; //RETURNS CORRECT COLUMN OBJECT
   
    columnGrid = view.grid.columns.byIndex(0);
    columnFrame = columnGrid.column; //RETURNS NULL, IT IS WRONG

0-th column in a grid is a row header column, therefore it has no matching data column. For instance, this is how you can set its width to 100:

grok.shell.addTableView(grok.data.demo.demog())
    .grid.columns.byIndex(0).width = 100;

And this will print “subj” (the name of the first column)

let grid = grok.shell.addTableView(grok.data.demo.demog()).grid;
console.log(grid.columns.byIndex(1).name);