Calculations

Tags: #<Tag:0x00007f8b25764500>

Hi there,

Hope someone can help. I am tying to perform some calculations once a column is changed but my code goes into an infinite loop… I have searched the forum and it seems that a few people have had the same problem but I cant get a any of the solutions to work. Can anyone help?

https://jsfiddle.net/Walters87/zcx96h2w/

Hi @waltersluke87

the afterChange is called once setDataAtCell is called so this

this.setDataAtCell(changes[0][0],6,data.calc_net);

has to be provided with the 4th parameter - the source. Then you will be able to add an IF statement that if the source is different than the one you chose run the code.

Example

if(source === 'myCustomSource'){
   this.setDataAtCell(changes[0][0],6,data.calc_net, 'myCustomSource'); 
}

Hi Aleksandra,

After a little playing around I managed to get it to work. Thanks again for your help.

For any future reference to any other users, this is how I got it to work:
https://jsfiddle.net/Walters87/zcx96h2w/

I’m glad to hear that @waltersluke87

feel free to open a new ticket when needed.