From 7b6ebfa639c4272b9a519597371267629fe7a1c1 Mon Sep 17 00:00:00 2001 From: Mottie Date: Sun, 21 Jun 2015 10:09:57 -0500 Subject: [PATCH] Scroller: correct column alignment. Fixes #940, #937, #931 & #927 Bonus fix #932 which maintains scroll position after sort/filter --- docs/example-widget-scroller.html | 47 ++++--- js/widgets/widget-scroller.js | 198 +++++++++++++----------------- 2 files changed, 113 insertions(+), 132 deletions(-) diff --git a/docs/example-widget-scroller.html b/docs/example-widget-scroller.html index 2f80a9e3..e72abe9a 100644 --- a/docs/example-widget-scroller.html +++ b/docs/example-widget-scroller.html @@ -94,18 +94,22 @@ } }); + var startFixedColumns = 2; + $('#fixed-columns-table').tablesorter({ theme: 'jui', showProcessing: true, headerTemplate : '{content} {icon}', widgets: [ 'uitheme', 'zebra', 'filter', 'scroller' ], widgetOptions : { - scroller_jumpToHeader : false, - scroller_upAfterSort : false, + // scroll tbody to top after sorting + scroller_upAfterSort: true, + // pop table header into view while scrolling up the page + scroller_jumpToHeader: true, scroller_height : 300, // set number of columns to fix - scroller_fixedColumns : 2, + scroller_fixedColumns : startFixedColumns, // add a fixed column overlay for styling scroller_addFixedOverlay : false, // add hover highlighting to the fixed column (disable if it causes slowing) @@ -118,7 +122,7 @@ // use jQuery UI slider to change the fixed column size $( '#slider' ).slider({ - value : 2, + value : startFixedColumns, min : 0, max : 4, step : 1, @@ -130,20 +134,15 @@ } }); + // update column value display + $( '.fixed-columns' ).text( startFixedColumns ); + });