From ea6d61516a8b4105c804ab5dffdbe685b55e1a95 Mon Sep 17 00:00:00 2001 From: Freek Dijkstra Date: Sun, 26 Feb 2012 23:30:09 +0100 Subject: [PATCH 1/6] Fix examples syntax fixedColumn -> fixedColumns --- demo/demo.js | 2 +- demo/test.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/demo.js b/demo/demo.js index 2ed6bf0..d90ace3 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -5,7 +5,7 @@ $(document).ready(function() { $('.myTable02').fixedHeaderTable({ height: '250', footer: true, altClass: 'odd', themeClass: 'fancyTable' }); - $('.myTable03').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, fixedColumn: true, themeClass: 'fancyTable' }); + $('.myTable03').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, fixedColumns: 1, themeClass: 'fancyTable' }); $('.myTable04').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, cloneHeadToFoot: true, fixedColumns: 3, themeClass: 'fancyTable' }); }); \ No newline at end of file diff --git a/demo/test.html b/demo/test.html index 45b2fb6..3f7e7d2 100644 --- a/demo/test.html +++ b/demo/test.html @@ -383,7 +383,7 @@ $('.myTable03').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, - fixedColumn: true, + fixedColumns: 1, themeClass: 'fancyTable' }); From 3e451a1a6945a357bc01818d3743f687a8c8fe0b Mon Sep 17 00:00:00 2001 From: Freek Dijkstra Date: Sun, 26 Feb 2012 23:53:34 +0100 Subject: [PATCH 2/6] Add example #05 with user-provided footer. --- demo/css/myTheme.css | 2 + demo/demo.js | 2 + demo/test.html | 313 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 317 insertions(+) diff --git a/demo/css/myTheme.css b/demo/css/myTheme.css index 25a596d..83cd7fe 100644 --- a/demo/css/myTheme.css +++ b/demo/css/myTheme.css @@ -104,6 +104,8 @@ } .fancyTable thead tr th, +.fancyTable thead tr td, +.fancyTable tfoot tr th, .fancyTable tfoot tr td { /* appearance */ background-color: #8ca9cf; diff --git a/demo/demo.js b/demo/demo.js index d90ace3..45f27a0 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -8,4 +8,6 @@ $(document).ready(function() { $('.myTable03').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, fixedColumns: 1, themeClass: 'fancyTable' }); $('.myTable04').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, cloneHeadToFoot: true, fixedColumns: 3, themeClass: 'fancyTable' }); + + $('.myTable05').fixedHeaderTable({ height: '400', altClass: 'odd', footer: true, fixedColumns: 1, themeClass: 'fancyTable' }); }); \ No newline at end of file diff --git a/demo/test.html b/demo/test.html index 3f7e7d2..27ee8bc 100644 --- a/demo/test.html +++ b/demo/test.html @@ -375,6 +375,319 @@ $('.myTable02').fixedHeaderTable({
+
+
+
+        			
+$('.myTable05').fixedHeaderTable({
+	height: '400',
+	altClass: 'odd',
+	footer: true,
+	fixedColumns: 1,
+	themeClass: 'fancyTable'
+});
+        			
+        		
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BrowserVisitsPages/VisitAvg. Time on Site% New VisitsBounce RateAvg. Time on Site% New VisitsBounce Rate
BrowserVisitsPages/VisitAvg. Time on Site% New VisitsBounce RateAvg. Time on Site% New VisitsBounce Rate
Firefox first1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:22 test test test70.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00% test test test32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
Firefox1,9903.1100:04:2270.00%32.61%00:04:2270.00%32.61%
+
+
+
+

From b2a37e054b6c10016c997968d9d975c0113a52b8 Mon Sep 17 00:00:00 2001
From: Freek Dijkstra 
Date: Mon, 27 Feb 2012 01:33:03 +0100
Subject: [PATCH 3/6] tfoot, tbody and thead may now contain either td or th.
 Previously thead could only contain th, while tbody and tfoot could only
 contain td.

---
 jquery.fixedheadertable.js | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js
index 4640508..c10f131 100644
--- a/jquery.fixedheadertable.js
+++ b/jquery.fixedheadertable.js
@@ -398,14 +398,14 @@
 		$thead			= $('
'), $tbody = $('
'), $tfoot = $('
'), - $firstThChildren,// = $fixedBody.find('.fht-thead thead tr th:first-child'), + $firstThChildren,// = $fixedBody.find('.fht-thead thead tr > *:first-child'), $firstTdChildren, fixedColumnWidth,// = $firstThChild.outerWidth(true) + tableProps.border, fixedBodyWidth = $wrapper.width(), fixedBodyHeight = $fixedBody.find('.fht-tbody').height() - settings.scrollbarOffset, $newRow; - $firstThChildren = $fixedBody.find('.fht-thead thead tr th:lt(' + settings.fixedColumns + ')'); + $firstThChildren = $fixedBody.find('.fht-thead thead tr > *:lt(' + settings.fixedColumns + ')'); fixedColumnWidth = settings.fixedColumns * tableProps.border; $firstThChildren.each(function(index) { fixedColumnWidth += $(this).outerWidth(true); @@ -420,7 +420,7 @@ tdWidths.push($(this).width()); }); - firstTdChildrenSelector = 'tbody tr td:not(:nth-child(n+' + (settings.fixedColumns + 1) + '))'; + firstTdChildrenSelector = 'tbody tr > *:not(:nth-child(n+' + (settings.fixedColumns + 1) + '))'; $firstTdChildren = $fixedBody.find(firstTdChildrenSelector) .each(function(index) { helpers._fixHeightWithCss($(this), tableProps); @@ -479,7 +479,7 @@ // setup clone footer with fixed column if (settings.footer == true || settings.cloneHeadToFoot == true) { - var $firstTdFootChild = $fixedBody.find('.fht-tfoot thead tr th:lt(' + settings.fixedColumns + ')'); + var $firstTdFootChild = $fixedBody.find('.fht-tfoot thead tr > *:lt(' + settings.fixedColumns + ')'); helpers._fixHeightWithCss($firstTdFootChild, tableProps); $tfoot.appendTo($fixedColumn) @@ -556,15 +556,15 @@ tableProp.border = ($obj.find('th:first-child').outerWidth() - $obj.find('th:first-child').innerWidth()) / borderCollapse; - $obj.find('thead tr:first-child th').each(function(index) { + $obj.find('thead tr:first-child > *').each(function(index) { tableProp.thead[index] = $(this).width() + tableProp.border; }); - $obj.find('tfoot tr:first-child td').each(function(index) { + $obj.find('tfoot tr:first-child > *').each(function(index) { tableProp.tfoot[index] = $(this).width() + tableProp.border; }); - $obj.find('tbody tr:first-child td').each(function(index) { + $obj.find('tbody tr:first-child > *').each(function(index) { tableProp.tbody[index] = $(this).width() + tableProp.border; }); @@ -578,10 +578,10 @@ _setupClone: function($obj, cellArray) { var $self = $obj, selector = ($self.find('thead').length) ? - 'thead th' : + 'thead tr:first-child > *' : ($self.find('tfoot').length) ? - 'tfoot td' : - 'tbody td', + 'tfoot tr:first-child > *' : + 'tbody tr:first-child > *', $cell; $self.find(selector).each(function(index) { From 23b510dac9af220b862006d80caac86b6cf38306 Mon Sep 17 00:00:00 2001 From: Freek Dijkstra Date: Mon, 27 Feb 2012 10:06:26 +0100 Subject: [PATCH 4/6] Footers scroll horizontally --- jquery.fixedheadertable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js index c10f131..d9ec1b6 100644 --- a/jquery.fixedheadertable.js +++ b/jquery.fixedheadertable.js @@ -342,7 +342,7 @@ 'margin-left': -this.scrollLeft }); - if (settings.cloneHeadToFoot) { + if (settings.footer || settings.cloneHeadToFoot) { $tfoot.find('table') .css({ 'margin-left': -this.scrollLeft @@ -479,7 +479,7 @@ // setup clone footer with fixed column if (settings.footer == true || settings.cloneHeadToFoot == true) { - var $firstTdFootChild = $fixedBody.find('.fht-tfoot thead tr > *:lt(' + settings.fixedColumns + ')'); + var $firstTdFootChild = $fixedBody.find('.fht-tfoot tr > *:lt(' + settings.fixedColumns + ')'); helpers._fixHeightWithCss($firstTdFootChild, tableProps); $tfoot.appendTo($fixedColumn) From e97620b3dda80297382acc89e196d35bb9e34825 Mon Sep 17 00:00:00 2001 From: Freek Dijkstra Date: Mon, 27 Feb 2012 10:11:38 +0100 Subject: [PATCH 5/6] Adjust width of fixed-column footers to account for footers with a colspan --- jquery.fixedheadertable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js index d9ec1b6..9cccd20 100644 --- a/jquery.fixedheadertable.js +++ b/jquery.fixedheadertable.js @@ -485,8 +485,11 @@ $tfoot.appendTo($fixedColumn) .find('tr') .append($firstTdFootChild.clone()); + // Set (view width) of $tfoot div to width of table (this accounts for footers with a colspan) + footwidth = $tfoot.find('table').innerWidth(); $tfoot.css({ - 'top': settings.scrollbarOffset + 'top': settings.scrollbarOffset, + 'width': footwidth, }); } }, From bb173860155b520e444eb9a0a1eeaba513b5514d Mon Sep 17 00:00:00 2001 From: Freek Dijkstra Date: Mon, 27 Feb 2012 11:19:53 +0100 Subject: [PATCH 6/6] Change thead to tfoot in .fht-fixed-column .fht-tfoot --- jquery.fixedheadertable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js index 9cccd20..a626ed3 100644 --- a/jquery.fixedheadertable.js +++ b/jquery.fixedheadertable.js @@ -397,7 +397,7 @@ $fixedColumn = $wrapper.find('.fht-fixed-column'), $thead = $('
'), $tbody = $('
'), - $tfoot = $('
'), + $tfoot = $('
'), $firstThChildren,// = $fixedBody.find('.fht-thead thead tr > *:first-child'), $firstTdChildren, fixedColumnWidth,// = $firstThChild.outerWidth(true) + tableProps.border,