user9912506
user9912506

Reputation:

Datatables function "fnDeleteRow" can't delete row

I use this code to delete a row in datatables.

$(".deleteRow").click(function() {
    var row = $(this).closest("tr"); 
    var nRow = row[0];
    table_reach_condition_appoint_datatable.dataTable().fnDeleteRow(nRow);
});

This code is the core code in js about delete row with datatables.

I have imported the related js in my html.

When I click the link to delete, you can see the picture: enter image description here

It is no effect,where is wrong?

Upvotes: 0

Views: 2303

Answers (1)

venkat.yerr
venkat.yerr

Reputation: 86

Try with this

table.row( $(this).parents('tr')) .remove().draw();

or

table.row($(this).closest("tr")) .remove().draw();

Upvotes: 1

Related Questions