Permalink
Browse files

stickyheaders scroll left now

  • Loading branch information...
Mottie committed Dec 6, 2011
1 parent 09752c6 commit 16c2108cd09443d84918def4e625ff4ee0b911ca
Showing with 31 additions and 15 deletions.
  1. +4 −0 README.markdown
  2. +5 −0 changelog.txt
  3. +14 −8 js/jquery.tablesorter.widgets.js
  4. +8 −7 js/jquery.tablesorter.widgets.min.js
View
@@ -34,6 +34,10 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
+####Version 2.0.23.4 (2011-12-6)
+
+* Updated the sticky header widget to reposition the sticky header when scrolling left. Fix for [issue #9](https://github.com/Mottie/tablesorter/issues/9).
+
#### Version 2.0.23.3 (2011-11-7)
* Updated the filter widget:
View
@@ -1,5 +1,10 @@
TableSorter Change Log
+Version 2.0.23.4 (2011-12-6)
+============================
+
+* Updated the sticky header widget to reposition the sticky header when scrolling left. Fix for [issue #9](https://github.com/Mottie/tablesorter/issues/9).
+
Version 2.0.23.3 (2011-11-7)
============================
@@ -1,4 +1,4 @@
-/* TableSorter 2.0 Widgets - updated 11/7/2011
+/* TableSorter 2.0 Widgets - updated 12/6/2011
*
* jQuery UI Theme
* Column Styles
@@ -154,7 +154,8 @@ $.tablesorter.addWidget({
id: "stickyHeaders",
format: function(table) {
if ($(table).find('.stickyHeader').length) { return; }
- var win = $(window),
+ var $table = $(table),
+ win = $(window),
header = $(table).find('thead'),
hdrCells = header.find('tr').children(),
brdr = parseInt(hdrCells.eq(0).css('border-left-width'),10),
@@ -170,7 +171,7 @@ $.tablesorter.addWidget({
}),
stkyCells = sticky.children();
// update sticky header class names to match real header
- $(table).bind('sortEnd', function(e,t){
+ $table.bind('sortEnd', function(e,t){
var th = $(t).find('thead tr'),
sh = th.filter('.stickyHeader').children();
th.filter(':not(.stickyHeader)').children().each(function(i){
@@ -197,14 +198,19 @@ $.tablesorter.addWidget({
// make it sticky!
win
.scroll(function(){
- var $t = $(table),
- offset = $t.offset(),
+ var offset = $table.offset(),
sTop = win.scrollTop(),
- vis = ((sTop > offset.top) && (sTop < offset.top + $t.find('tbody').height())) ? 'visible' : 'hidden';
- sticky.css('visibility', vis);
+ vis = ((sTop > offset.top) && (sTop < offset.top + $table.find('tbody').height())) ? 'visible' : 'hidden';
+ sticky.css({
+ left : offset.left - win.scrollLeft(),
+ visibility : vis
+ });
})
.resize(function(){
- sticky.css({ width: header.outerWidth() + brdr * 2 });
+ sticky.css({
+ left : $(table).offset().left - win.scrollLeft(),
+ width: header.outerWidth() + brdr * 2
+ });
stkyCells.each(function(i){
$(this).width( hdrCells.eq(i).width() );
});

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 16c2108

Please sign in to comment.