destroy(false) still removes table
destroy(false) still removes table
ButchNZ
Posts: 20Questions: 6Answers: 0
With version 1.13.1 this code:
relatedTable.clear().destroy(false);
Does seem to delete all the table dom.
I say seems as this is a Laravel Livewire app which does change the dom a lot.
I'm updating some values in the table which Livewire does but removes the Datatables functionality from it so I needed to reinitialise.
If I cache the table dom before I clear().destroy() then reinsert it and reinit the table it seems to work. For example:
var cache = false;
if ($.fn.dataTable.isDataTable('#RelatedProjectTable'))
{
cache = $('#TableWrapper').html();
relatedTable.clear().destroy(false);
}
setTimeout(function(){
if (cache)
{
$('#TableWrapper').html(cache);
}
relatedTable = $('#RelatedProjectTable').DataTable(conf);
}, 1000);
Answers
https://live.datatables.net/raborefu/1/edit
It seems to work okay here. Perhaps you can link to a test case showing the issue?
Allan
Messaged you some details
Thanks! Send a PM back. Let's continue the discussion there.
Allan