hot.setDataAtCell

Tags: #<Tag:0x00007efc64b086e8>

In my code when i supposed to enter a value in a cell, based on that cell value i need to set a value in another cell getting from array(source) by looping it. similarly in the same row i need to perform this action for two more cells, but due to the setDataAtCell is performing infinite loop i cannot handle the situation. Can you please help me with this. In the code i used notvalid in if condition if i declare the variable inside event it is going infinite times else due to global declartion of notvalid variable it works until it is set to true then it exits loop. please help me

Hey @srinivas.sri.t

you can stop the loop by using the last parameter of the setDataAtCell method - the source.

If you add an additional exception to run the setDataAtCell if the source is not your_string it will not be called one after another.

Thanks for quick response @aleksandra_budnik
I’m not clear that what should be passed in source parameter that would stop the loop. if possible just give my an example with reference to my code or demo.

The beforeChange has two parameters, arrays of changes the the string representation of a change (example loadData after we initiate the table). You just need to add an IF to check the the string inside the setDataAtCell doesn’t equal the string from the 2nd beforeChange parameter.

Here’s an example https://jsfiddle.net/handsoncode/8pyr7zx0/

Thank you so much @aleksandra_budnik for immediate response
By modifying code it worked. Thanks again @aleksandra_budnik

You’re welcome :slight_smile: