I am trying to get the position of a row in datatables using the following code
var table = $('#UserInformationTable').dataTable();
var row_id = table.fnGetPosition($('#row_' + id));
table.fnDeleteRow(row_id);
The $('#row_' + id)
is returning a tr.
The fnGetPosition
does not work. I am getting this error:
TypeError: Cannot call method 'toUpperCase' of undefined
What am I doing wrong?
table.fnGetPosition();
expects a DOM node and you're passing a jQuery object. Change it from:
table.fnGetPosition($('#row_' + id));
to
table.fnGetPosition($('#row_' + id)[0]);
fnGetPosition
expects a node, not a jQuery object. So try:
var row_id = table.fnGetPosition($('#row_' + id)[0]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With