mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
New: columns and cell index() API methods
- The row()/rows() methods have index methods, so it makes sense that the column(s) and cell(s) methods also have index methods to get the raw information out of the table. Rather than shying away from the indexes in 1.10, as has been done with the pervious versions of DataTables, 1.10 will embrase them as first class citizens. - New methods: - columns().index() - column().index() - cells().index() - cell().index()
This commit is contained in:
parent
01cc744b00
commit
bea47e6470
@ -67,6 +67,17 @@ _api.register( 'cells().data()', function () {
|
||||
} );
|
||||
|
||||
|
||||
_api.registerPlural( 'cells().index()', 'cell().index()', function () {
|
||||
return this.iterator( 'cell', function ( settings, row, column ) {
|
||||
return {
|
||||
row: row,
|
||||
column: column,
|
||||
columnVisible: _fnColumnIndexToVisible( settings, column )
|
||||
};
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
_api.register( [
|
||||
'cells().invalidate()',
|
||||
'cell().invalidate()'
|
||||
|
@ -117,6 +117,16 @@ _api.registerPlural( 'columns().visible()', 'column().visible()', function ( vis
|
||||
} );
|
||||
|
||||
|
||||
|
||||
_api.registerPlural( 'columns().index()', 'column().index()', function ( type ) {
|
||||
return this.iterator( 'column', function ( settings, column ) {
|
||||
return type === 'visible' ?
|
||||
_fnColumnIndexToVisible( settings, column ) :
|
||||
column;
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
// _api.register( 'columns().show()', function () {
|
||||
// var selector = this.selector;
|
||||
// return this.columns( selector.cols, selector.opts ).visible( true );
|
||||
|
Loading…
x
Reference in New Issue
Block a user