Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

handsontable / javascript - Disable new rows being added by dragging

I have a handsontable table which is dynamic, meaning data can be added after initiation. The problem is, however, that new rows can be added to the table when dragging down while clicking the corner of a cell. How would I prevent users from expanding the table while making sure I can still add new rows if one would interact with a button for example.

I tried using

afterCreateRow: function(index, amount){ data.splice(index, amount) },

but that prevents me from adding new rows using the alter function. If this question was rather vague: See the link below for a default jsfiddle with handsontable. Click the corner of a cell and drag down, you'll see.

http://jsfiddle.net/warpech/hU6Kz/

TL;DR: Disable row creation when dragging cells, allow row creation using (in code) handsontable.alter('insert_row');

Thanks in advance.

like image 233
Dubb Avatar asked Aug 02 '16 08:08

Dubb


1 Answers

You can add this code to prevent row creation when you are dragging cells :

fillHandle: {
    autoInsertRow: false,
},
like image 115
Joakim Si Ali Avatar answered Nov 14 '22 23:11

Joakim Si Ali