How to delete current row with jquery datatable plugin

leora picture leora · Dec 18, 2009 · Viewed 40.3k times · Source

I have a column with buttons in a table I'm using jQuery datatable plugin. The buttons say "Remove" and the idea is that when you click on that button it deletes the current row in the table.

When I call fnDeleteRow it seems to work the first time but no any further time for that row so it looks like its not really deleting the row properly.

Answer

Jason Orendorff picture Jason Orendorff · Dec 18, 2009

Try this:

var row = $(this).closest("tr").get(0);
oTable.fnDeleteRow(oTable.fnGetPosition(row));

If it doesn't work, check the following example