diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index 9c9f2a4e..5b86a93c 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -95,111 +95,84 @@ function _fnCreateTr ( oSettings, iRow, nTrIn, anTds ) */ function _fnBuildHead( oSettings ) { - var i, nTh, iLen, j, jLen; - var iThs = $('th, td', oSettings.nTHead).length; - var iCorrector = 0; - var jqChildren; + var i, ien, cell, row, column; + var thead = oSettings.nTHead; + var tfoot = oSettings.nTFoot; + var createHeader = $('th, td', thead).length === 0; var classes = oSettings.oClasses; var columns = oSettings.aoColumns; - /* If there is a header in place - then use it - otherwise it's going to get nuked... */ - if ( iThs !== 0 ) - { - /* We've got a thead from the DOM, so remove hidden columns and apply width to vis cols */ - for ( i=0, iLen=columns.length ; itr').attr('role', 'row'); /* Deal with the footer - add classes if required */ - $(oSettings.nTHead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH ); - $(oSettings.nTFoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH ); + $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH ); + $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH ); /* Cache the footer elements */ - if ( oSettings.nTFoot !== null ) - { + if ( tfoot !== null ) { var anCells = _fnGetUniqueThs( oSettings, null, oSettings.aoFooter ); - for ( i=0, iLen=columns.length ; i