Can't remove last data table row by JQuery row object

Can't remove last data table row by JQuery row object

GleebleGleeble Posts: 14Questions: 0Answers: 0
edited June 2011 in Bug reports
So I've got a table that will have n>0 records in it. The table contains a column with an icon that can be used to remove records from the table using the dataTables API.

Here is the delete function:
[code]
function deleteRow(button){
$("#editGridtable").dataTable().fnDeleteRow($(button).parents("tr"));
buildAddFormsDropdown();
}
[/code]

and here is the error according to firebug at line 3243 of the non-minimized javascript file:
[code]
...
for ( var j=iStart ; j

Replies

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    fnDeleteRow expects a TR node as the first argument, rather than a jQuery object ( http://datatables.net/api#fnDeleteRow ). The easy change would be to just add a '[0]' after the .parents("tr") to get the node.

    Allan
  • GleebleGleeble Posts: 14Questions: 0Answers: 0
    Ah, that makes sense. Thanks!
This discussion has been closed.