setDataAtCell does not pass down source when changes are passed as array

Tags: #<Tag:0x00007efc71a18b68> #<Tag:0x00007efc71a18780>

setDataAtCell does not pass down source when changes are passed as array.

When we use the drag-fill and pass custome source from the setDataAtCell, We are still getting “edit” as source value.

In code snippet you will see a button below grid , when you click on the button you can see the source argument received by beforeChange and afterChnage in the console.

Please refer the code snippet : https://codepen.io/tbankar/pen/LYKwWpG

Thank you for sharing the issue report, @mkumar

I replicated the issue and will update you as soon as it gets fixed.

Hi @aleksandra_budnik,
Can I get an ETA on this? we have multiple features broken because of this.

The issue is in the backlog at the moment.

Maybe I can recommend a workaround (also only official API) where you call batch() for the setDataAtCell() and run the loop for all of the changes.

So if we save the values of changes in an array like this

var arrayOfChanges = [[0,0,'A1','Z1'],[1,0,'A2','Z2']]

this would be the old approach (currently broken array of changes)

function changeValues() {
  hot.setDataAtCell(arrayOfChanges, 'drag.fill');
}

and the new approach would be

function changeValues() {
  hot.batch(() => {
    arrayOfChanges.forEach(([row, col, , newValue]) => hot.setDataAtCell(row, col, newValue, 'drag.fill'));
  });

The batch() method allows us to cut off all unnecessary rendering of the table, and it should be as performant as the array approach.

Here’s a new demo https://jsfiddle.net/d1abq5s6/

Hi @mkumar

I have good news.

The following issue is solved in v15.0.0

We get the expected logs

afterChange: loadData
beforeChange: singleChange
afterChange: singleChange
beforeChange: multipleChange
afterChange: multipleChange