Handsontable example
HTML
<link rel="stylesheet" href="https://docs.handsontable.com/pro/1.14.2/bower_components/handsontable-pro/dist/handsontable.full.min.css">
<script src="https://docs.handsontable.com/pro/1.14.2/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
<input type="checkbox" class="hide"> Hide columns
<div id="example1" class="hot handsontable htColumnHeaders"></div>
CSS
.pink {
color: pink;
}
JavaScript
document.addEventListener("DOMContentLoaded", function() {
var
container = document.getElementById('example1'),
hot;
var data = [
['John', 'Smith', '49', 'Teacher']
];
hot = new Handsontable(container, {
data: data,
colWidths: 100,
colHeaders: ['Name', 'Surname', 'Age']
});
var hide = document.querySelector('.hide');
hide.addEventListener('change', function() {
if (hide.checked) {
hot.updateSettings({
hiddenColumns: {
columns: [2, 3],
indicators: true
}
})
} else {
hot.updateSettings({
hiddenColumns: {
columns: [],
indicators: true
}
})
}
})
});