What is the best way to sync selected cells values to a variable outside handsontable?

Tags: #<Tag:0x00007f8b19f57e80> #<Tag:0x00007f8b19f57d40>

I have a particular cell (or a group of cells) that I want to track to an external javascript variable. Whenever these cells change I want to change the outside variable too. What is the best way to do this?

I thought of using afterChange hook and updating the variable. This works when the table structure does not change, however if the table structure changes - for example if I add a new row above my row - then my pointer gives me wrong cells. How can we tackle this? I want to track these cells even if new rows and columns are added between them (or above them).

Use case: I want to create charts from selected number of cells, not the entire table. But when a user adds rows or columns inside this selected range, I need to automatically update the chart.

Hi @wekal63791

Thank you for contacting us. Indeed, using afterChange hook would be the best choice. Regarding the wrong indexes I think that in this case you can take advantage of our index mapper to get the correct cells. You can read more about it here: