Copy a value from a cell to multiple selected cells

Is not a problem (we solved it), is more a question about the recommended way to do this.

I’d like to ask you about the proper way to copy a value from a cell to multiple selected cells. We discovered that we could use the array of changes adding more changes to this array, effortless and straightforward, another way is to use the setDataAtCell method from the hotable instance, but in this case, some events are trigger again.

Some questions are,
Is this the proper way to do it?, only adding new changes to the array in beforeChange, or we need to worry about some side effects?
To use setDataAtCell, is a better way to do it? in this case, what is the proper way to use this function?.
A better way to do this maybe?

I have an example in the next link with the expected result, so basically you need to select all the cells and enter some value, this value should be copied to all the selected cells.
https://jsfiddle.net/ngcbassman/jqc59xhw/11/

Thanks in advance.

Just a suggestion:
in line 26: instead of null, add hot.getDataAtCell(actualRowIndex, col) so that the undo can get the previous values again for all the other selected cells. (https://jsfiddle.net/jqc59xhw/12/)
Otherwise, I think your implementation is pretty neat in my opinion (but perhaps wait for a moderator to confirm).

(aabounegm) Thanks for the response and the suggested improvement, but why not use the other approach setDataAtCell?, is this a better or simpler approach? or the wrong one with some side effects?.

As you already said, using setDataAtCell will fire afterChange and beforeChange again for every cell. So, if it will make no difference in functionality, I think it might affect performance.

Hi @claudio @aabounegm Is the anything I can do for you?