Using the following, I am adding SUM outputs on the last row, updating this if a row is added.
How can I set this last row to be readonly? In the documentation it shows setting entire columns or indiviual cells, but not rows. If I use the cells approach, the cells keep changing as rows are added… is there a way to apply the readonly in the ‘afterCreateRow’ function?
hot.alter('insert_row', hot.countRows());
hot.setDataAtCell(hot.countRows() - 1, 0, '=SUM(A1:A' + (hot.countRows() - 1) + ')')
hot.setDataAtCell(hot.countRows() - 1, 1, '=SUM(B1:B' + (hot.countRows() - 1) + ')')
var myLastSum = 0;
hot.updateSettings({
beforeCreateRow: function(i, amount) {
myLastSum = i - 1;
},
afterCreateRow: function(i, amount) {
hot.setDataAtCell(hot.countRows() - 1, 0, '=SUM(A1:A' + (hot.countRows() - 1) + ')');
hot.setDataAtCell(i - 1, 0, '');
hot.setDataAtCell(hot.countRows() - 1, 1, '=SUM(B1:B' + (hot.countRows() - 1) + ')');
hot.setDataAtCell(i - 1, 1, '');
}
});