Handsontable example
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@9.0/dist/handsontable.full.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@9.0/dist/handsontable.full.min.css" />
<button id="resetbtn">Reset table's settings</button>
<div id="example1" class="hot "></div>
JavaScript
const btn = document.querySelector('#resetbtn');
const container = document.querySelector('#example1');
const hot = new Handsontable(container, {
data: Handsontable.helper.createSpreadsheetData(10, 10),
height: 300,
width: 450,
rowHeaders: true,
colHeaders: true,
licenseKey: 'non-commercial-and-evaluation',
persistentState: true,
manualColumnMove: true,
columnSorting: true,
manualColumnResize: true,
});
const mcmPlugin = hot.getPlugin('manualColumnMove');
const csmPlugin = hot.getPlugin('columnSorting');
const mcrPlugin = hot.getPlugin('manualColumnResize');
btn.addEventListener('click', () => {
hot.runHooks('persistentStateReset');
hot.initIndexMappers();
mcmPlugin.updatePlugin();
csmPlugin.updatePlugin();
mcrPlugin.updatePlugin();
hot.render();
});