mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-20 18:54:15 +01:00
New: column.index() API method for translating column indexes
- The fnVisibleToColumnIndex and fnColumnIndexToVisible plug-in API methods for the old API were very useful for transforming the visible column index to the actual index, and the return. This adds that capability to the new API.
This commit is contained in:
parent
7b6ebd63de
commit
a767c05f1d
@ -141,9 +141,19 @@ _api.register( 'columns.adjust()', function () {
|
||||
} );
|
||||
} );
|
||||
|
||||
// _api.register( 'column.index()', function ( idx, type ) {
|
||||
// Convert from one column index type, to another type
|
||||
_api.register( 'column.index()', function ( type, idx ) {
|
||||
if ( this.context.length !== 0 ) {
|
||||
var ctx = this.context[0];
|
||||
|
||||
// } );
|
||||
if ( type === 'fromVisible' || type === 'toIndex' ) {
|
||||
return _fnColumnIndexToVisible( ctx, idx );
|
||||
}
|
||||
else if ( type === 'fromIndex' || type === 'toVisible' ) {
|
||||
return _fnVisibleToColumnIndex( ctx, idx );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user