nestedHeaders + autoColumnSize: true: grown columns leave a permanent gap after scrolling to the end

Hello, I just tried to upgrade to the latest version, hoping all the issues have been addressed but found a new problem (see below). Not sure exactly when this broke but it used to work fine in 16.2.

Thanks!

Version: 18.1.1

Summary

When nestedHeaders is enabled with autoColumnSize not set to false, NestedHeaders grows columns via its ghost table, but never invalidates Walkontable’s column PositionCache. That cache only rebuilds when column count changes (PositionCache.isCurrent() checks count, not size), so any column whose offset was cached before the ghost table’s growth settled keeps a stale, pre-growth position forever. The scrollbar itself is sized correctly off the grown widths, but rendered column positions lag behind, so scrolling to the true end leaves a permanent blank gap, as if the last column(s) never rendered. See attached example: the autoColumnSize: true grid shows the gap; autoColumnSize: false (same data/columns) does not.

Why only this plugin

autoColumnSize’s own plugin avoids this: it writes measured widths to a tracked columnWidthsMap and calls columnIndexMapper.observeMapChange(this.columnWidthsMap, () => this.hot.view?.invalidateColumnWidthCache()) once in enablePlugin(). NestedHeaders’ _onModifyColWidth (in plugins/nestedHeaders/nestedHeaders.mjs) has no equivalent — it just returns a different width through the modifyColWidth hook on demand, with no cache invalidation:

_onModifyColWidth = (width, column) => {
    if (this.hot.getSettings().autoColumnSize === false) return width;
    const cachedWidth = this.ghostTable.getWidth(column) ?? 0;
    return width > cachedWidth ? width : cachedWidth;
};

Suggested fix: NestedHeaders should call this.hot.view?.invalidateColumnWidthCache() whenever buildWidthsMap() produces a changed width, the same way autoColumnSize does.

cc @dhaber

Hi @shrvic , thanks for the detailed report! That made it easy to reproduce and confirm. I’ve created an issue here:

I’ll update this post with an ETA once we have a fix ready to deploy. For now, you can work around it with the autoSize: false as you mentioned, or keep autoColumnSize: true and call hot.render() once after the table settles.

Thanks Joseph!

UPDATE: This has been fixed on our develop branch

I’ll update again when it ships in the next release. Thanks again for reporting it!

Nice! You’re welcome and thanks for keeping me in the loop.