CAUSE
When DataTables destroys the table because of the option destroy:true it restores original content and discards the content that you’ve generated.
SOLUTION #1
Remove destroy:true option and destroy the table before you manipulate the table with destroy() API method.
if ( $.fn.DataTable.isDataTable('#tblRemittanceList') ) {
$('#tblRemittanceList').DataTable().destroy();
}
$('#tblRemittanceList tbody').empty();
// ... skipped ...
$('#tblRemittanceList').dataTable({
"autoWidth":false,
"info":false,
"JQueryUI":true,
"ordering":true,
"paging":false,
"scrollY":"500px",
"scrollCollapse":true
});
SOLUTION #2
Remove destroy:true option and instead of destroying and recreating the table use clear() to clear the table content, rows.add() to add the table data and then draw() to re-draw the table.
In this case you would need to initialize DataTables once on page initialization.