Issues after setting Grid column width

After setting the widths of Grid columns, the horizontal scroll bar seems to have wrong value. As a result, the Grid’s content becomes no longer scrollable. In addition to that, the redrawing operation is called for every column of the Grid. It instead should be called only for the columns visible in the viewport to avoid the performance penalty. These issues are reproducible after clicking on the column header. Same “excessive” redrawing occurs when moving the mouse over the column header after the initial click. Please see the console log.

let nRowCount = 1000;
let nColCount = 100;
let grid = grok.shell.addTableView(grok.data.demo.randomWalk(nRowCount, nColCount)).grid;

let bClicked = false;

rxjs.fromEvent( grid.overlay, 'click').subscribe((e) => {

    let nButton = e.button;
    if (nButton === 0)
    {
        let cell = grid.hitTest(e.offsetX, e.offsetY);
        if (cell.isColHeader) {
            bClicked = true;

            let colGrid = null;
            for (var nCol = 0; nCol < nColCount; ++nCol) {
                colGrid = grid.columns.byIndex(nCol);
                colGrid.width = 75 + nCol;
            }

        }
    }
});

grid.onCellRender.subscribe(function (args) {
      if(!bClicked)
        return;
      
    let nCol = args.cell.gridColumn.idx;

    if(args.cell.isColHeader) {
        console.log("Column Header " + nCol);
    }
});

Thanks for reporting this issue, Dmitry! I’ve just managed to reproduce the problem using the latest version of Datagrok. We will investigate the issue and keep you updated.

Good catch! It is fixed, the latest version will be up and running in 30 minutes.