Getting issue while destroy/Reinitialize Individual search Data table
Getting issue while destroy/Reinitialize Individual search Data table
On a button click want to fetch fresh updated data in data table , when reinitialize table it will become multiple headers
Note i am using Individual search in data table .
Kindly find my below code for the same:
var table;
if ( $.fn.dataTable.isDataTable('#CompletedTID') ) {
table = $('#CompletedTID').DataTable();
table.destroy();
}
$('#CompletedTID thead tr').clone(true).appendTo('#CompletedTID thead');
$('#CompletedTID thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
$(this).html('<input type="text" placeholder="' + title + '" />');
$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {
table
.column(i)
.search(this.value)
.draw();
}
});
});
table = $('#CompletedTID').DataTable({
fixedHeader: true,
destroy:true
});
Replies
Duplicate of this thread. Please don't post duplicate threads. See my answer in your other thread.
Kevin