From 946eefe0547346c59198f7c4417ab75c773196f9 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 2 Nov 2010 18:25:00 +0000 Subject: [PATCH] New: Column visibility options in DataTables (bVisible and fnSetColumnVis) now take into account more than one row in THEAD and TFOOT. Please note that colspan and rowspan are NOT supported when using column visibility options in the header and footer, and will very likely have effects which are not at all desirable. As such there are conditions on this use (note that if you only have one row in the header / footer, then this has no impact), specifically the number of cells in the header / footer much be equal to the columns * rows (in each one). This way DataTables can accurately add and remove the cells as needed. The cells may be either TH or TD elements, but DataTables still requires at least one TH element for each column. Updated: Previously when multiple cells were detected as unique to a column the last one would be given priority (i.e. sorting event handler etc). This is now no longer the case and the first will take priority. --- media/js/jquery.dataTables.js | 71 +++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 74652f62..f8ad61a1 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -1946,7 +1946,7 @@ var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] ); var i, iLen; var iColumns = oSettings.aoColumns.length; - var nTd, anTds; + var nTd, anTds, nCell, anTrs, jqChildren; /* No point in doing anything if we are requesting what is already true */ if ( oSettings.aoColumns[iCol].bVisible == bShow ) @@ -1980,9 +1980,20 @@ if ( iInsert >= _fnVisbleColumns( oSettings ) ) { nTrHead.appendChild( anTheadTh[iCol] ); + anTrs = $('>tr', oSettings.nTHead); + for ( i=1, iLen=anTrs.length ; itr', oSettings.nTFoot); + for ( i=1, iLen=anTrs.length ; itr', oSettings.nTHead); + for ( i=1, iLen=anTrs.length ; itr', oSettings.nTFoot); + for ( i=1, iLen=anTrs.length ; i