Merge cells plugin is altering source data

As noted in this support issue, the merge cells plugin is nulling out all but the root merged cell, including at the source data level, which can be seen by the response to getSourceData (as described in that support issue).

It seems incorrect to me for the plugin to be altering our source data in response to a request to visually merge the data. In fact, the documentation clearly states:

Cell merging happens on Handsontable’s visual layer and doesn’t affect your source data structure.

Can you help?

Thanks,
David

Hi David,

You are right. After reading

Cell merging happens on Handsontable’s visual layer and doesn’t affect your source data structure.

in the documentation developer would expect here

to have the second call (source data)

console.log(hot.getDataAtCell(1,2));
console.log(hot.getSourceDataAtCell(1,2));

Demo: Handsontable example - JSFiddle - Code Playground

to be what was defined in the dataset. Which in this case is (1, 2).

I do not see any conversation about it on Github, so I will consult it with the team. I will update you as soon as I get any feedback.

1 Like

That was the perfect timing for this question, @dhaber as I was able to consult my colleague on a daily meeting today. Team agreed that the documentation is incorrect. Both methods

console.log(hot.getDataAtCell(1,2));
console.log(hot.getSourceDataAtCell(1,2));

should return null and the values should be removed.

I will report the need to alter documentation.