From 2ef1314562d00d5370738143c7da3ba1277ae2f6 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Mon, 1 Aug 2011 09:12:58 -1000 Subject: [PATCH] Fix column widths on FF3.x --- jquery.fixedheadertable.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js index 2a0bf89..4edd956 100644 --- a/jquery.fixedheadertable.js +++ b/jquery.fixedheadertable.js @@ -379,20 +379,21 @@ /* * return void */ - _fixWidthWithCss: function( $obj, tableProps ) { + _fixWidthWithCss: function( $obj, tableProps, width ) { if ( settings.includePadding ) { $obj.each(function(index) { $(this).css({ - 'width': $(this).width() + tableProps.border + 'width': width == undefined ? $(this).width() + tableProps.border : width + tableProps.border }); - }); + }); } else { $obj.each(function(index) { $(this).css({ - 'width': $(this).parent().width() + tableProps.border + 'width': width == undefined ? $(this).parent().width() + tableProps.border : width + tableProps.border }); }); } + }, /* @@ -424,11 +425,16 @@ helpers._fixHeightWithCss( $firstThChildren, tableProps ); helpers._fixWidthWithCss( $firstThChildren, tableProps ); + var tdWidths = []; + $firstThChildren.each(function(index) { + tdWidths.push($(this).width()); + }); + firstTdChildrenSelector = 'tbody tr td:not(:nth-child(n+' + (settings.fixedColumns + 1) + '))'; $firstTdChildren = $fixedBody.find(firstTdChildrenSelector) .each( function(index) { - helpers._fixHeightWithCss( $(this), tableProps ); - helpers._fixWidthWithCss( $(this), tableProps ); + helpers._fixHeightWithCss( $(this), tableProps); + helpers._fixWidthWithCss( $(this), tableProps, tdWidths[index % settings.fixedColumns] ); }); // clone header