|
1 |
| -/*! Widget: scroller - updated 2018-02-25 (v2.29.6) *//* |
| 1 | +/*! Widget: scroller - updated 2018-05-07 (v2.30.4) *//* |
2 | 2 | Copyright (C) 2011 T. Connell & Associates, Inc.
|
3 | 3 |
|
4 | 4 | Dual-licensed under the MIT and GPL licenses
|
|
203 | 203 | wo.scroller_calcWidths = [];
|
204 | 204 | wo.scroller_saved = [ 0, 0 ];
|
205 | 205 | wo.scroller_isBusy = true;
|
| 206 | + wo.scroller_scrollTimer = null; |
206 | 207 |
|
207 | 208 | // set scrollbar width to one of the following (1) explicitly set scroller_barWidth option,
|
208 | 209 | // (2) detected scrollbar width or (3) fallback of 15px
|
|
273 | 274 | .off( 'scroll' + namespace )
|
274 | 275 | .on( 'scroll' + namespace, function() {
|
275 | 276 | // Save position
|
276 |
| - wo.scroller_saved[0] = $tableWrap.scrollLeft(); |
277 |
| - wo.scroller_saved[1] = $tableWrap.scrollTop(); |
| 277 | + clearTimeout(wo.scroller_scrollTimer); |
| 278 | + wo.scroller_scrollTimer = setTimeout(function() { |
| 279 | + wo.scroller_saved[0] = $tableWrap.scrollLeft(); |
| 280 | + wo.scroller_saved[1] = $tableWrap.scrollTop(); |
| 281 | + }, 300); |
278 | 282 | if ( wo.scroller_jumpToHeader ) {
|
279 | 283 | var pos = $win.scrollTop() - $hdr.offset().top;
|
280 | 284 | if ( $( this ).scrollTop() !== 0 && pos < tbHt && pos > 0 ) {
|
|
295 | 299 |
|
296 | 300 | $table
|
297 | 301 | .off( namespace )
|
| 302 | + .on( 'sortStart' + namespace, function() { |
| 303 | + clearTimeout(wo.scroller_scrollTimer); |
| 304 | + wo.scroller_isBusy = true; |
| 305 | + }) |
298 | 306 | .on( 'sortEnd filterEnd'.split( ' ' ).join( namespace + ' ' ), function( event ) {
|
299 | 307 | // Sorting, so scroll to top
|
300 | 308 | if ( event.type === 'sortEnd' && wo.scroller_upAfterSort ) {
|
301 |
| - $tableWrap.animate({ |
302 |
| - scrollTop : 0 |
303 |
| - }, 'fast' ); |
| 309 | + $tableWrap |
| 310 | + .scrollLeft( wo.scroller_saved[0] ) |
| 311 | + .animate({ scrollTop : 0 }, 'fast', function() { |
| 312 | + wo.scroller_isBusy = false; |
| 313 | + }); |
304 | 314 | } else if ( wo.scroller_fixedColumns ) {
|
305 | 315 | setTimeout( function() {
|
306 | 316 | // restore previous scroll position
|
|
859 | 869 | $fixedColumn.find('caption').height( wo.scroller_$header.find( 'caption' ).height() );
|
860 | 870 |
|
861 | 871 | $tableWrap.scroll();
|
862 |
| - wo.scroller_isBusy = false; |
| 872 | + setTimeout(function() { |
| 873 | + wo.scroller_isBusy = false; |
| 874 | + }, 0) |
863 | 875 |
|
864 | 876 | },
|
865 | 877 |
|
|
0 commit comments