setDataAtCell inside afterChange hook

Tags: #<Tag:0x00007efc64b579c8>

Hi, I’m getting problem to use setDataAtCell inside afterChange hook. I want to uppercasing the word that user wrote in any cell of a specific column. Here’s my code:

this.hotInstance.addHook(‘afterChange’, function(changes, src) {
if(src == “edit”)
{
var row = changes[0][0];
var value = changes[0][3];
this.hotInstance.setDataAtCell(row, 5, value);
}
});

But " this.hotInstance.setDataAtCell(row, 5, value);" is not working inside afterChange hook. If I put it outside with “hardcoded” parameters it works but this is not what I want my code to do. Could someone please help me ? I don’t know what’s wrong.

Hi @phelipegm

Here’s an example https://jsfiddle.net/y4w83tup/1/

ps. be sure to add this 4th parameter for the setDataAtCell method and add the source condition to the IF statement. Not adding the source condition would end up with an infinite loop.