Handsontable example
HTML
<div id="example1"></div>
<p>
after remove one column last and second last column will become readonly.
</p>
CSS
</style>
<script src="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.css">
JavaScript
var box = document.querySelector('#example1');
var hot = new Handsontable(box, {
data: Handsontable.helper.createSpreadsheetData(10, 5),
contextMenu: true,
formulas: true,
cells: function(row, column, prop) {
var cellMeta = {};
//make column readonly
if ((this.instance.getColHeader().length - 1) == column) {
cellMeta.readOnly = true;
}
if ((this.instance.countRows() - 1) == row) {
cellMeta.readOnly = true;
}
return cellMeta;
}
})