Event Listeners Keep adding after destroy()
Event Listeners Keep adding after destroy()
From the manual:
"It is important to remove events from objects which no longer exist (before they are destroyed) to allow the Javascript engine's garbage collector to release the memory allocated for the events and the objects it has attached to."
I have several events listeners that I need to remove before detroying the table (wich I do often with server-side processing) but I don't know most of them. Is there a function to remove all?
Tried with off() but when i re-initialize the table all listeners remain off.
Thanks in advance.
Answers
Can you link to an example page showing the issue? Using
$(...).off('click');
(for click events) should be enough.Allan
Sorry but I don't have an example to show.
Was doing some test and I discovered that the table is not the problem, the listeners that remain active are from the ColVis extension, if I remove it from the table everything is fine.
There is something going on when I destroy the table that migth need extra actions to ensure the ColVis extension is also clear.