I want to destroy and recreate my excel sheet i'm using Handsontable for it the object is getting destroyed and created new but the data inside the row is same for new table as well for old one
since the title is similar to SO QUESTION
i've implemented what was the answer in previous SO question but i'm still stuck
JSFIDDLE
<div id="example1" class="hot handsontable"></div>
<select class="client_class">
<option value="">Select client</option>
<option value="DEFGH">DEFGH</option>
</select>
var autosaveNotification;
var hotInstance;
var setting1 = {
data: [],
colHeaders: ['InvoiceNo', 'InvoiceDate', 'Supplier'],
columns: [{
data: 'InvoiceNo'
}, {
data: 'InvoiceDate'
}, {
data: 'Supplier'
}],
rowHeaders: true,
minSpareRows: 1,
minRows: 5,
manualColumnResize: true,
manualRowResize: true,
fixedColumnsLeft: 1,
manualColumnMove: true,
manualRowMove: true,
};
hotInstance = new Handsontable(jQuery("#example1")[0], setting1);
jQuery('.client_class').on('change', function () {
var selected = $(this).find("option:selected").val();
console.log(hotInstance.getData());
hotInstance.destroy();
hotInstance = new Handsontable(jQuery("#example1")[0], setting1);
console.log(hotInstance.getData());
});