I want to delete datatable row permanently
if I delete all the rows, i want datatable will display the default "No data available" text.
I already try some POST : But no luck
DataTables remove row button with answer :
$("#dataTables-example").on('click', '.btn-info', function () {
$(this).parent().parent().remove();
});
I cannot remove row with jQuery with answer :
$( 'tbody tr:last-child' ).remove();
But, when I delete all the rows, the text "No data available" does not appear. and when
thead
is clicked, it will bring up the deleted row.
========================
jQuery delete row :
$(document).on('click', '.deleteRow', function() {
$(this).closest('tr').remove();
});
in dataTable func :
"columns": [
{ "data": "id"},
{ "data": "name" },
{ "data": "subtype"},
{ "data": "approximate_count" },
{ "data": "time_created" },
{data: null ,
"sClass" : "center",
"sDefaultContent" : '<button class="deleteRow">Delete</button> '
},
],