autoInsertRow does not prevent inserting rows

This looks like this has been a bug forever, or is it just misunderstood? Even setting this, it does not prevent adding new rows.

fillHandle={{
  direction: "vertical",
  autoInsertRow: false,
}}

https://codesandbox.io/p/devbox/react-handsontable-forked-6d8pq5?workspaceId=ws_FBUmtLZMPJxRa4ZC91xHCh

Hi @anthony.agostino

Sorry for delay. We should be able to answer the question with a demo early next week.

1 Like

Hi @anthony.agostino

The autoIndertRow relates to the behavior of the fillhandle/autofill. So it will not create new rows when we autofill.

Demo Handsontable example - JSFiddle - Code Playground

When we set the autoInsertRow to true - we can add new rows by autofilling the value

true

When we set the autoInsertRow to false - we cannot add new rows by autofilling the value

false

This is also how it works in your demo. I cannot autofill the data so it add more rows that the already 100 that were defined.

Please tell me what is the exact requirement that you have.

Ah thanks for the response, I thought this applied to copy/paste as well after selecting many rows. Looking for a similar option to not create new rows on copy paste.

The easiest way to limit the amount of rows entirely is to use the maxRows option (it can be altered via updateSettings() method if you’d like to change it along the way).

Here’s a demo Handsontable example - JSFiddle - Code Playground. We have maxRows set up to 10. Now, user cannot autofill to add rows, if they paste data it is cut to fit the last row. Also, when you allow to add rows via context-menu user will have the option grayed out if there are already 10 rows in the grid.

1 Like

Great, thanks. Although I highly encourage an option called “disableAddRows” or similar.

1 Like