I am using datatable plugin for table when I am trying to delete current row, the first row getting delete from datatable and in search also that deleted row shoudnot display
this is my jQuery code:
var table = $('#stockistTable').DataTable();
index = $(this).closest('tr').index();
table.row(index.rowIndex-1).remove().draw( false );
You can make a Jquery object of the entire row element and pass it in row() function of Datatable.
var table = $('#stockistTable').DataTable();
var removingRow = $(this).closest('tr');
table.row(removingRow).remove().draw();
You can try this
$(document).ready(function() {
var table = $('#stockistTable').DataTable();
$('tr').on("click", function(e) {
index = $(this).closest('tr').index();
table.row( $(this) ).remove().draw();
});
} );
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