Tutorial: Data binding

Data binding

Edit this page
Edit this page

Understand binding as a reference

Handsontable binds to your data source (array or object) by reference. Therefore, all the data entered in the grid will alter the original data source. In complex applications, you may have a purpose to change data source from outside of Handsontable. A changed being made will not be presented on the screen unless you refresh the grid on the screen using the render method.

Change data without rendering changes

In case you want to keep a separate working copy of data for Handsontable, it is suggested to clone the data source before loading it into Handsontable. This can be done with JSON.parse(JSON.stringify(data)) or another deep-cloning function.

Clone data before saving it

In a similar way, you may find it useful to clone data before saving it. That would be useful to make programmatic changes that would be saved to the server but kept invisible to the user.