Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable adding new rows/cols in handsontable?

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?

like image 786
PolGraphic Avatar asked May 17 '14 15:05

PolGraphic


1 Answers

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
like image 135
PostureOfLearning Avatar answered Oct 23 '22 13:10

PostureOfLearning