mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-18 16:54:14 +01:00
Dev fix: The insertBefore for column visibility was incorrect if the next column was hidden as well. Need to 'fast-forward' to the next visible column to get the insert point.
This commit is contained in:
parent
844bbaf4ee
commit
9cf1ff785e
18
media/js/jquery.dataTables.js
vendored
18
media/js/jquery.dataTables.js
vendored
@ -2025,7 +2025,7 @@
|
||||
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
|
||||
var i, iLen;
|
||||
var iColumns = oSettings.aoColumns.length;
|
||||
var nTd, nCell, anTrs, jqChildren, bAppend;
|
||||
var nTd, nCell, anTrs, jqChildren, bAppend, iBefore;
|
||||
|
||||
/* No point in doing anything if we are requesting what is already true */
|
||||
if ( oSettings.aoColumns[iCol].bVisible == bShow )
|
||||
@ -2047,6 +2047,20 @@
|
||||
|
||||
/* Need to decide if we should use appendChild or insertBefore */
|
||||
bAppend = (iInsert >= _fnVisbleColumns( oSettings ));
|
||||
|
||||
/* Which coloumn should we be inserting before? */
|
||||
if ( !bAppend )
|
||||
{
|
||||
for ( i=iCol ; i<iColumns ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible )
|
||||
{
|
||||
iBefore = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( oSettings.aoData[i].nTr !== null )
|
||||
@ -2061,7 +2075,7 @@
|
||||
{
|
||||
oSettings.aoData[i].nTr.insertBefore(
|
||||
oSettings.aoData[i]._anHidden[iCol],
|
||||
_fnGetTdNodes( oSettings, i )[iCol+1] );
|
||||
_fnGetTdNodes( oSettings, i )[iBefore] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user