When using custom renderers, hiddenColumns and colWidths the rendering fails to work properly

Tags: #<Tag:0x00007f8b1d2fe770>

I have found a bug and the line of code causing the problem.

To reproduce the problem, please look at the following fiddle.
If you scroll down you will see that the rendering doesn’t happen as it should.

https://jsfiddle.net/stuartrichardson/70kmzt2L/

I have tracked this problem down to the function onAfterGetCellMeta

  } else if (cellProperties.baseRenderer !== null) {
    // We must pass undefined value too (for the purposes of inheritance cell/column settings).
    cellProperties.renderer = cellProperties.baseRenderer;
    cellProperties.baseRenderer = null;
  }

In this particular case cellProperties.renderer is already defined to be the custom renderer and then it gets redefined to baseRenderer which is undefined.

The workaround that I am doing at the moment is to check whether renderer is defined already (not too sure if this will cause other problems yet):
} else if (!cellProperties.renderer && cellProperties.baseRenderer !== null) {
// We must pass undefined value too (for the purposes of inheritance cell/column settings).
cellProperties.renderer = cellProperties.baseRenderer;
cellProperties.baseRenderer = null;
}

Thank you for sharing the demo @srichardson

the first thing that I usually do is to make the demo as simple as possible.
This https://jsfiddle.net/handsoncode/xyqfeaud/ (v7.1.1.) is the simplest example that I was able to make.

It looks like we need only two rows to replicate the bug.

What I’ve changed
hiddenColumns, according to docs, can be a boolean value or an object so defining it as an empty array is against the rules… however, while defining it as an empty or filled object we still get the same effect.

image

What’s interesting even when we define the whole object

  hiddenColumns: {
    columns: [],
    indicators: true
  }

the issue stays the same.

It happens the same when we define anything in the hiddenColumns > columns

 hiddenColumns: {
    columns: [1],
    indicators: true
  }

When the issue’s gone

  • when we comment our colWidths
  • when we comment our hiddenColumns
  • when we call render method after initializing the table

How to track the issue
It looks like this issue has been raised here https://github.com/handsontable/handsontable/issues/5883
I will update you as soon as we get this done.

Hi @srichardson

I have good news! We’ve just released 8.0.0-beta2 that fixes the mentioned issue. We won’t be closing this ticket now. It will be closed after we release the final 8.0.0 version of Handsontable.

Here’s a full list of changes https://github.com/handsontable/handsontable/releases/tag/8.0.0-beta.2
NPM https://www.npmjs.com/package/handsontable/v/8.0.0-beta.2

All feedback’s appreciated. Thank you for your input.

This issue was solved in v.8.0.0.