mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Dev: Tidy up _fnColumnIndexToVisible and _fnVisibleToColumnIndex to use the new _fnGetColumns method.
This commit is contained in:
parent
d034d187bd
commit
5311067cd2
36
media/js/jquery.dataTables.js
vendored
36
media/js/jquery.dataTables.js
vendored
@ -229,22 +229,11 @@
|
||||
*/
|
||||
function _fnVisibleToColumnIndex( oSettings, iMatch )
|
||||
{
|
||||
var iColumn = -1;
|
||||
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
||||
|
||||
for ( var i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible === true )
|
||||
{
|
||||
iColumn++;
|
||||
}
|
||||
|
||||
if ( iColumn == iMatch )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return typeof aiVis[iMatch] === 'number' ?
|
||||
aiVis[iMatch] :
|
||||
null;
|
||||
}
|
||||
|
||||
|
||||
@ -258,21 +247,10 @@
|
||||
*/
|
||||
function _fnColumnIndexToVisible( oSettings, iMatch )
|
||||
{
|
||||
var iVisible = -1;
|
||||
for ( var i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible === true )
|
||||
{
|
||||
iVisible++;
|
||||
}
|
||||
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
||||
var iPos = $.inArray( iMatch, aiVis );
|
||||
|
||||
if ( i == iMatch )
|
||||
{
|
||||
return oSettings.aoColumns[i].bVisible === true ? iVisible : null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return iPos !== -1 ? iPos : null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,22 +169,11 @@ function _fnAdjustColumnSizing ( oSettings )
|
||||
*/
|
||||
function _fnVisibleToColumnIndex( oSettings, iMatch )
|
||||
{
|
||||
var iColumn = -1;
|
||||
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
||||
|
||||
for ( var i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible === true )
|
||||
{
|
||||
iColumn++;
|
||||
}
|
||||
|
||||
if ( iColumn == iMatch )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return typeof aiVis[iMatch] === 'number' ?
|
||||
aiVis[iMatch] :
|
||||
null;
|
||||
}
|
||||
|
||||
|
||||
@ -198,21 +187,10 @@ function _fnVisibleToColumnIndex( oSettings, iMatch )
|
||||
*/
|
||||
function _fnColumnIndexToVisible( oSettings, iMatch )
|
||||
{
|
||||
var iVisible = -1;
|
||||
for ( var i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible === true )
|
||||
{
|
||||
iVisible++;
|
||||
}
|
||||
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
||||
var iPos = $.inArray( iMatch, aiVis );
|
||||
|
||||
if ( i == iMatch )
|
||||
{
|
||||
return oSettings.aoColumns[i].bVisible === true ? iVisible : null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return iPos !== -1 ? iPos : null;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user