1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-30 12:24:10 +01:00

Fix: Add a method for plug-ins to have a destructor for when DataTables is destroyed - allowing clean up of events and anything else the plug-in has done. Plug-ins should add an object to aoDestroyCallback with 'sName' (to identify the plug-in) and 'fn' as the plug-ins destroy function.

This commit is contained in:
Allan Jardine 2011-07-13 21:05:02 +01:00
parent 61f05f8da7
commit 1bf42d2ca9

View File

@ -1467,6 +1467,13 @@
* Scope: jQuery.dataTable.classSettings
*/
this.oInit = null;
/*
* Variable: aoDestroyCallback
* Purpose: Destroy callback functions
* Scope: jQuery.dataTable.classSettings
*/
this.aoDestroyCallback = [];
}
/*
@ -2138,6 +2145,11 @@
/* Flag to note that the table is currently being destoryed - no action should be taken */
oSettings.bDestroying = true;
/* Restore hidden columns */
for ( i=0, iLen=oSettings.aoDestroyCallback.length ; i<iLen ; i++ ) {
oSettings.aoDestroyCallback[i].fn();
}
/* Restore hidden columns */
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{