Event Listeners Keep adding after destroy()

Event Listeners Keep adding after destroy()

agrigeraagrigera Posts: 3Questions: 2Answers: 0

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

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Can you link to an example page showing the issue? Using $(...).off('click'); (for click events) should be enough.

    Allan

  • agrigeraagrigera Posts: 3Questions: 2Answers: 0

    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.

This discussion has been closed.