Reputation: 3364
First of all, there is an well-known bug with handsontable
(which is a great piece of code anyway), mentioned by e.g. user tezhm, on official github issues list for handsontable:
When selecting a cell on the last row of a table and drag-selecting below the row into an area outside of the table, the scroll viewport is triggered causing a malfunction of the view. This can be recreated using the demo tables.
Because of it, I decided to either turn off scrollbars completely or disable adding new rows/cols.
But how to disable adding new rows/cols in handsontable
?
Alternatively, how to disable scrolling in handsontable
?
Upvotes: 9
Views: 9752
Reputation: 273
Use below options , this works for me..
fillHandle: {
direction: 'vertical',
autoInsertRow: false,
}
Upvotes: 3
Reputation: 1898
I have tried
minSpareRows: 0,
minSpareCols: 0
But no luck :(.
Finally, I tried something like the following:
afterCreateRow: function (index, numberOfRows) {
data.splice(index, numberOfRows);
}
It did the work :)
Upvotes: 3
Reputation: 3541
To disable adding new rows/columns, set the following options:
minSpareRows: 0,
minSpareCols: 0
If you are using a context menu, you can disable the functionality with:
contextMenu: ["undo", "redo"]
Another option could be to set maxRows
to the number of rows in your data and maxCols
to the number of columns in your data. Note: if you are using the columns
option, maxCols
will be ignored.
maxRows: data.numberOfRows,
maxCols: data.numberOfColumns
Upvotes: 16