I'm using handsontable to edit a table with a pre-determined number of rows.
Unfortunately, when I paste a number of rows larger than the number of rows, new rows are automatically added.
e.g.: Pasting a 15-line clipboard in a 10-line handsontable causes 5 new lines to be inserted
How can I disable this behavior and truncate the paste instead?
Thanks!
@paulo-raca I was looking for a similar option. The easiest thing you can do now is to set the maxRows option to your predetermined number of rows:
var table = new Handsontable(element, {
maxRows: 10
});
Another option would be implementing an beforeCreateRow event (similar to afterCreateRow) that can return false or throw an exception to block the new row(s). That would be more work though.
maxRows is a good idea, thanks!
maxRows: mydata.length worked liked a charm for me. Thanks donmccurdy.
Most helpful comment
@paulo-raca I was looking for a similar option. The easiest thing you can do now is to set the maxRows option to your predetermined number of rows:
Another option would be implementing an
beforeCreateRowevent (similar toafterCreateRow) that can return false or throw an exception to block the new row(s). That would be more work though.