DataTable re-initialization not working
DataTable re-initialization not working
rsalunga29
Posts: 6Questions: 2Answers: 0
Hello I've been trying the following methods but none is working.
Method 1:
$('#table').DataTable({
retrieve: true,
destroy: true
})
Method 2:
if($.fn.dataTable.isDataTable('#table')) {
$('#table').DataTable().destroy()
$('#table').DataTable({retrieve:true})
} else {
$('#table').DataTable({retrieve:true})
}
Method 3:
$('#table').DataTable().destroy()
$('#table').DataTable({retrieve:true})
Please help, thank you!
This discussion has been closed.
Answers
Please describe what is not working. Do you get errors (alerts or browser's console)?
Is the above the only Javascript code you have for initializing Datatables?
Maybe you can post a link to your page or a test case showing the issue. This will give us the information needed to help you debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi @rsalunga29 ,
I'm not clear what you're doing there. The
retrieve
should be used when you want to access an already initialised table. You're using thatSo, I wouldn't expect that to work.
Cheers,
Colin