Trigger cell rerender

Is there a way to trigger a re-render of already rendered cells or even better tell the TableView / Grid to re-render a column or row if needed?

Reason behind the question: we would like to trigger such a re-render once a user has changed the row or column dimension in order to get our customCellRender re-executed.

We’ve just exposed the invalidate method, here’s the corresponding commit: https://github.com/datagrok-ai/public/commit/a8fecf6ed920cd996cdb34c541fd11bd4e53fcee. The functionality should be available on our dev environment in 30 minutes.

And an example of the whole grid refreshing every second and counting how many times each cell has been drawn (might be useful for debugging purposes):

@dpetrov.gnf.org - you might be interested in that as well (cell-specific invalidation is coming, too)

let grid = grok.shell.addTableView(grok.data.demo.demog()).grid;
grid.onCellPrepare(function (gc) {
  let xy = `${gc.gridColumn.name}_${gc.gridRow}`;
  counts[xy] = counts[xy] == null ? 1 : counts[xy] + 1;
  gc.customText = `${counts[xy]}`;
});

setInterval(() => { grid.invalidate(); }, 1000);
1 Like

Love to test this on our environment.