mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-19 17:54:14 +01:00
API - dev: Remove the plugin() methods from the new API
- Decided that it would be better to provide the new API by having plug-ins extend it directly, rather than providing their own API. Using the plugin() method it was possible to get a plug-in insta,ce for example TableTools, but the way it should work is that TableTools would provide a tabletools() API method, registering it as an extension to the DataTables API objects. Further more, TableTools should provide methods such as row().select() etc, extending the current API rather than doing its own thing which the plugin() methods prompted. - No backwards compatiblity issues here as the plugin() code hasn't shipped as a release.
This commit is contained in:
parent
cf8f008a4d
commit
a423c0f457
@ -1 +1 @@
|
||||
7b5141122b2fad2d3cef2a333c518646018dc531
|
||||
9dc32c5fa50fabd9447a9e67fec49a6275c7bd5b
|
||||
|
44
media/js/jquery.dataTables.js
vendored
44
media/js/jquery.dataTables.js
vendored
@ -8331,50 +8331,6 @@
|
||||
} );
|
||||
|
||||
|
||||
// Remove plugin methods
|
||||
_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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user