diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 88fab9e1..fdf6a63a 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -ddd0e5f5c9509cd8fa5630453cc05c9f68863644 +730e2b88377acb44e9db177e107b9d42ac8bf63f diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 99253af7..2b854b74 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -6038,7 +6038,7 @@ { if ( ! this instanceof _Api ) { throw 'DT API must be constructed as a new object'; - // or should it do the 'new' for the caller + // or should it do the 'new' for the caller? // return new _Api.apply( this, arguments ); } @@ -8241,6 +8241,49 @@ } ); + _api.register( 'plugin()', function ( type ) { + var ctx = this.context; + + if ( ! ctx.length ) { + return null; + } + + var plugins = ctx[0].oPlugins[ type ]; + + return ! plugins ? + null : + plugins.length == 1 ? + plugins[0] : + plugins; + } ); + + _api.register( 'plugin.register()', function ( type, inst ) { + return this.iterator( 'table', function ( settings ) { + var plugins = settings.oPlugins; + + if ( ! plugins[ type ] ) { + plugins[ type ] = []; + } + + plugins[ type ].push( inst ); + } ); + } ); + + _api.register( 'plugin.deregister()', function ( type, inst ) { + return this.iterator( 'table', function ( settings ) { + var plugins = settings.oPlugins[ type ]; + + if ( plugins ) { + var idx = $.inArray( inst, plugins ); + + if ( idx >= 0 ) { + plugins.splice( idx, 1 ); + } + } + } ); + } ); + + _api.register( 'destroy()', function ( remove ) { remove = remove || false; @@ -12616,7 +12659,14 @@ * @type array * @default [] */ - "aLastSort": [] + "aLastSort": [], + + /** + * Stored plug-in instances + * @type object + * @default {} + */ + "oPlugins": {} }; /**