mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-29 11:24:10 +01:00
New: columns().order() method for the new API
- I think it makes intuative sense to be able to tell the table to order on the columns given by the selector, which is exactly what this method does.
This commit is contained in:
parent
d9119fc3cb
commit
89b2404511
@ -113,11 +113,11 @@
|
||||
require('api.draw.js');
|
||||
require('api.page.js');
|
||||
require('api.ajax.js');
|
||||
require('api.order.js');
|
||||
require('api._selectors.js');
|
||||
require('api.rows.js');
|
||||
require('api.row.js');
|
||||
require('api.columns.js');
|
||||
require('api.order.js');
|
||||
require('api.search.js');
|
||||
require('api.static.js');
|
||||
require('api.core.js');
|
||||
|
@ -77,5 +77,22 @@ _Api.register( 'order.listener()', function ( node, column, callback ) {
|
||||
} );
|
||||
|
||||
|
||||
// Order by the selected column(s)
|
||||
_Api.register( 'columns().order()', function ( dir ) {
|
||||
var that = this;
|
||||
|
||||
return this.iterator( 'table', function ( settings, i ) {
|
||||
var sort = [];
|
||||
|
||||
$.each( that[i], function (j, col) {
|
||||
sort.push( [ col, dir ] );
|
||||
} );
|
||||
|
||||
settings.aaSorting = sort;
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
|
||||
}());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user