what worked for me is to destroy the dataTable when the insert button is clicked, and not on the extract data button. Thus, the button that destroys the dataTable does not recreate the table. And another function that is called from another button click creates a dataTable. the code is simple:
Button that destroys dataTable:
var otable = $('#claimRecordTable').dataTable();
if (otable != null) otable.fnDestroy();
which created dataTable:
$('#claimRecordTable').dataTable();
source
share