Error occurs when calling row().remove().draw('page')

Error occurs when calling row().remove().draw('page')

JamaurJamaur Posts: 87Questions: 10Answers: 0
edited September 6 in Free community support

I am currently working with version 2.1.5.

The exception below is thrown when calling api.row().remove().draw('page').

"Uncaught TypeError: Cannot read properties of null (reading 'nTr')"

Test case: https://live.datatables.net/vuxobuyi/1/edit (Click on any row)

Please note that everything works correctly when calling either draw('full-reset') or draw('full-hold').

Replies

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,953

    I suspect its related to the samefix that caused issues in this thread. I think fix will be different for this issue. @allan will need to take a look.

    Kevin

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin

    The .draw('page') doesn't recompute the rows to be shown - thus an error is thrown as that causes a row that has been deleted to be drawn, which of course it can't.

    .draw('full-hold') is the correct option to use if you want to hold the current page, but update to take account of the deleted row.

    I'll add a note into the documentation about this.

    Allan

  • JamaurJamaur Posts: 87Questions: 10Answers: 0
    edited September 7

    Hi Allan,

    Thanks for the reply. Please note that this used to work in version 1.10.x. Either way, I have no problem using draw('full-hold').

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin

    Yeah, there have been a lot of chances since then. The big one for 2.0 which will trigger this error is the use of a sparse array for the data store. 1.x would have had a different outcome.

    full-hold is the right way to do it :)

    Allan

Sign In or Register to comment.