setDataAtCell to null for type text in afterChange event throwing infinite loop

Tags: #<Tag:0x00007f8b1db41220>

Hello,

I am trying to put null for type:text using setDataAtCell in afterChange event. It is going infinite loop.

But, when I tried to put null for type:numeric, it is working.

I had gone through multiple solutions online. But no luck. Help me to get this resolved.

My code is like below.

let val = this.hotTable21.getDataAtCell(row[0][0], this.hotTable21.propToCol(‘ppCategory1’));
if (val != null && val != ‘None’ && val != ‘’ && val != undefined) {
if (!val.includes(‘Other’)) this.hotTable21.setDataAtCell(row[0][0], this.hotTable21.propToCol(‘ppCategory2’), null);

if ppCategory1 does not have value “Other”, then ppCategory2 should be set to empty.

Hi @madanmame

have you added the last parameter to the setDataAtCell method (source)?

Then you can use the source to attach a check (IF) to avoid the infinite loop.

This happens as the setDataAtCell is triggering afterChange hook, so the call does not stop.