I have code like below:
HTML
<div id="rangePricesGrid" class="handsontable" style="width: auto; overflow: auto"></div>
Javascript:
var rangePriceGrid = $('#rangePricesGrid').handsontable('getInstance');
if (rangePriceGrid != undefined) {
rangePriceGrid.destroy();
if (setRangeGridOptions != undefined)
rangePriceGrid = $('#rangePricesGrid').handsontable(setRangeGridOptions);
} else {
if (setRangeGridOptions != undefined)
rangePriceGrid = $('#rangePricesGrid').handsontable(setRangeGridOptions);
}
On page load, it works fine and paints the HOT. But then when I update one of the properties (say Data, and number of columns also) of HOT and then calls above method, it fails at the below
rangePriceGrid = $('#rangePricesGrid').handsontable(setRangeGridOptions);
with error
Uncaught Error: This method cannot be called because this Handsontable instance has been destroyed
What am I doing wrong here ? I know the HOT table is destoryed, but I am trying to re-created it with updated options.
Please suggest