Error occurs when calling row().remove().draw('page')
Error occurs when calling row().remove().draw('page')
Jamaur
Posts: 87Questions: 10Answers: 0
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
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
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
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').
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 itAllan