destroy event firing for already destroyed tables
destroy event firing for already destroyed tables
mindguard
Posts: 3Questions: 1Answers: 0
Hey.
I am observing something strange but maybe this behaviour is ok:
When I re-initialize a datatable that has destroy:true it seems still alive. I can observe this when I write something into the console during the destroy event. For each re-initialisation all former datatables fire the destroy event as well.
Seems to me like a bug. Or am I missing something?
This discussion has been closed.
Answers
The reason is you are using jQuery to add a new destroy event handler each time you initialize Datatables. You can either turn off the event handler then turn it back on as in this example:
https://jsfiddle.net/cjvs2gzq/
Or instead of chaining the event you can just enable it once like this example:
https://jsfiddle.net/ps2wj87y/
Kevin
Awesome. Thank you!