From f3bd978b8fc697e568517b4c2ab8d08bfc26fb95 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 27 Apr 2011 19:18:08 +0100 Subject: [PATCH] Dev fix: Clean up the calls to _fnDrawHead --- media/js/jquery.dataTables.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index abc8964f..4173e2be 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -2087,10 +2087,10 @@ oSettings.aoColumns[iCol].bVisible = bShow; /* Redraw the header and footer based on the new column visibility */ - _fnDrawHead( oSettings, oSettings.aoHeader, oSettings.nTHead ); + _fnDrawHead( oSettings, oSettings.aoHeader ); if ( oSettings.nTFoot ) { - _fnDrawHead( oSettings, oSettings.aoFooter, oSettings.nTFoot ); + _fnDrawHead( oSettings, oSettings.aoFooter ); } /* If there are any 'open' rows, then we need to alter the colspan for this col change */ @@ -2344,10 +2344,10 @@ /* Build and draw the header / footer for the table */ _fnBuildHead( oSettings ); - _fnDrawHead( oSettings, oSettings.aoHeader, oSettings.nTHead ); + _fnDrawHead( oSettings, oSettings.aoHeader ); if ( oSettings.nTFoot ) { - _fnDrawHead( oSettings, oSettings.aoFooter, oSettings.nTFoot ); + _fnDrawHead( oSettings, oSettings.aoFooter ); } /* Okay to show that something is going on now */ @@ -3058,9 +3058,10 @@ * Returns: - * Inputs: object:oSettings - dataTables settings object * array objects:aoSource - Layout array from _fnDetectHeader - * node:nTarget - The header or footer element to layout + * boolean:bIncludeHidden - If true then include the hidden columns in the calc, + * - optional: default false */ - function _fnDrawHead( oSettings, aoSource, nTarget ) + function _fnDrawHead( oSettings, aoSource, bIncludeHidden ) { var i, iLen, j, jLen, k, kLen; var aoLocal = []; @@ -3068,6 +3069,11 @@ var iColumns = oSettings.aoColumns.length; var iRowspan, iColspan; + if ( typeof bIncludeHidden == 'undefined' ) + { + bIncludeHidden = false; + } + /* Make a copy of the master layout array, but without the visible columns in it */ for ( i=0, iLen=aoSource.length ; i