Question T13304
Visible to All Users

Row Index not returning proper index in matrixDynamic

created 2 years ago

I have a form where I have used matrixDynamic and have set minRowCount as 1. When I first fill up the form everything works fine and the delete button is hidden for the first row.

When I reload the form and the data gets auto-populated, now this time the first row comes with a delete button.

On checking in onMatrixAllowRemoveRow function, I found the first row index to be 1.

What could be the issue ?

Answers approved by surveyjs Support

created 2 years ago

Hello Yash,
If you set a minimum number of rows to 1, the Dynamic Matrix doesn't allow users to remove all rows. You can test the following demo: https://plnkr.co/edit/J79ExQiis9eFHUFE.

You can see that a remove row button is initially available for both matrix rows. However, if you remove a row so that a single row remains, the remove row button disappears preventing users to remove the last row.

2023-05-31_17-21-37.gif

Please let me know if this is what you want to achieve.

Thanks