I want to update the data source json via
hot = new Handsontable(container,
.....
in somewhere in the code:
hot.getData().push({/*...*/ });
I want to redraw the hot in html-page after this line. How to force do it?
There are a few ways of doing what you're asking. Here I present two of them, pulled almost straight out of the documentation page.
The first is using the loadData
function:
loadData (data: Array) Reset all cells in the grid to contain data from the data array
This one is self explanatory. The thing with it is that it will trigger hot.render()
automatically, as well as a few other events (like afterChange
).
If you didn't want to do that, you can use the second method which is more "raw". This one involves basic javascripts principles. Handsontable is initialized with a reference to your data
object. If you were to mutate this object, and then render, it would be the same as using loadData
but without triggering the events.