Fixed pager + filter problems reported in issue #207.

This commit is contained in:
Mottie 2013-01-04 12:10:17 -06:00
parent 3e9b5d56ce
commit 6eb36a6532
8 changed files with 44 additions and 58 deletions

View File

@ -36,6 +36,21 @@ tablesorter can successfully parse and sort many types of data including linked
View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change).
#### Version 2.7.1 (1/4/2013)
* Added two internal parameters to always make sure we're targeting the correct elements.
* Added `table.config.$table` which is a jQuery object of the table.
* Added `table.config.$tbodies` which is a jQuery object of sortable tbodies; the ones without the class name in the `cssInfoBlock` option.
* Fixed removal methods:
* Tablesorter destroy will now properly restore the header and remove all bindings.
* Widgets should now again be removed properly.
* Updated the storage utility to allow setting a property to an empty string, previously it was just ignored.
* Fixed pager issues:
* Pager status will now update properly while filtering rows.
* Pager status will also update properly after sorting filtered rows.
* The above issues were fixes for [issue #207](https://github.com/Mottie/tablesorter/issues/207).
* Fixed the pager's `fixedHeight` option to again properly pad the table to maintain the height.
#### Version 2.7 (12/26/2012) #### Version 2.7 (12/26/2012)
* Added `headerTemplate` option: * Added `headerTemplate` option:
@ -113,35 +128,3 @@ View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Chan
* Added `footerRow` and `footerCells` to the tablesorter themes (`$.tablesorter.themes`): * Added `footerRow` and `footerCells` to the tablesorter themes (`$.tablesorter.themes`):
* This allows styling of the footer in the bootstrap and jQuery UI themes. * This allows styling of the footer in the bootstrap and jQuery UI themes.
* Used by the `uitheme` widget. * Used by the `uitheme` widget.
#### Version 2.5.2 (11/27/2012)
* Fixed an issue with the pager making recursive ajax calls. Fixes [issue #182](https://github.com/Mottie/tablesorter/issues/182).
#### Version 2.5.1 (11/26/2012)
* Fixed a serious bug which occurrs in IE:
* This bug is related to the multi-column sorting changes made in v2.5 - I swear I'll add unit testing soon!
* This problem appeared to occur in all versions of IE.
* See [issue #181](https://github.com/Mottie/tablesorter/issues/181) for details.
* Updated the grey and bootstrap themes:
* The w3c recommendations for linear gradients are now being followed ([ref](http://dev.w3.org/csswg/css3-images/#linear-gradients)) - added a "to" to the position.
* Fixed the older IE filter for gradients. Apparently `startColorstr='#555'` is a different color than `startColorstr='#555555'`.
#### Version 2.5 (11/22/2012)
* Improved multi-column sorting
* Huge thanks to [Nick Craver](https://github.com/NickCraver) for making multicolumn sorting no longer uses an `eval()` during the sort!
* This change improves performance of the sort across all browsers.
* It also allows use of numerous minifier scripts.
* See [pull request #177](https://github.com/Mottie/tablesorter/pull/177) for more details.
* Fixed using `addRows` on an empty table, [issue #179](https://github.com/Mottie/tablesorter/issues/179).
* Fixed inconsistencies in the usage of sort up (ascending) and sort down (descending) in the javascript and css.
* Updated the `cssAsc` default value to `tablesorter-headerAsc`.
* Updated the `cssDesc` default value to `tablesorter-headerDesc`.
* All css themes now include these new class names. References to older class names were not removed, but they will be removed in version 3.
* Renamed image files and switched data URIs to match these changes.
* This fixes [issue #173](https://github.com/Mottie/tablesorter/issues/173). Thanks [bitti](https://github.com/bitti)!
* Updated all theme css files to use image data URIs instead of the images.
* The images are all still contained in the `css/images` directory.
* References to the image files have been commented out instead of removed.

View File

@ -1,6 +1,6 @@
/*! /*!
* tablesorter pager plugin * tablesorter pager plugin
* updated 12/26/2012 * updated 1/4/2013
*/ */
/*jshint browser:true, jquery:true, unused:false */ /*jshint browser:true, jquery:true, unused:false */
;(function($) { ;(function($) {
@ -94,7 +94,7 @@
updatePageDisplay = function(table, c) { updatePageDisplay = function(table, c) {
var i, p, s, t, out, f = $(table).hasClass('hasFilters') && !c.ajaxUrl; var i, p, s, t, out, f = $(table).hasClass('hasFilters') && !c.ajaxUrl;
c.filteredRows = (f) ? $(table).find('tbody tr:not(.filtered)').length : c.totalRows; c.filteredRows = (f) ? table.config.$tbodies.children('tr:not(.filtered,.remove-me)').length : c.totalRows;
c.filteredPages = (f) ? Math.ceil( c.filteredRows / c.size ) : c.totalPages; c.filteredPages = (f) ? Math.ceil( c.filteredRows / c.size ) : c.totalPages;
if ( Math.min( c.totalPages, c.filteredPages ) > 0 ) { if ( Math.min( c.totalPages, c.filteredPages ) > 0 ) {
t = (c.size * c.page > c.filteredRows); t = (c.size * c.page > c.filteredRows);
@ -138,7 +138,7 @@
if (h) { if (h) {
d = h - $b.height(); d = h - $b.height();
if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) { if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) {
$b.append('<tr class="pagerSavedHeightSpacer remove-me" style="height:' + d + 'px;"></tr>'); $b.append('<tr class="pagerSavedHeightSpacer ' + table.config.selectorRemove.replace('.','') + '" style="height:' + d + 'px;"></tr>');
} }
} }
} }
@ -188,9 +188,9 @@
var i, j, hsh, $f, $sh, var i, j, hsh, $f, $sh,
$t = $(table), $t = $(table),
tc = table.config, tc = table.config,
$b = $(table.tBodies).filter(':not(.' + tc.cssInfoBlock + ')'), $b = c.$tbodies,
hl = $t.find('thead th').length, tds = '', hl = $t.find('thead th').length, tds = '',
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove + '"><td style="text-align: center;" colspan="' + hl + '">' + err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove.replace('.','') + '"><td style="text-align: center;" colspan="' + hl + '">' +
(exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '</td></tr>', (exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '</td></tr>',
result = c.ajaxProcessing(data) || [ 0, [] ], result = c.ajaxProcessing(data) || [ 0, [] ],
d = result[1] || [], d = result[1] || [],
@ -302,6 +302,7 @@
}, },
renderTable = function(table, rows, c) { renderTable = function(table, rows, c) {
c.isDisabled = false; // needed because sorting will change the page and re-enable the pager
var i, j, o, var i, j, o,
f = document.createDocumentFragment(), f = document.createDocumentFragment(),
l = rows.length, l = rows.length,
@ -454,6 +455,7 @@
$t $t
.unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager') .unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager')
.bind('filterStart.pager', function(e, filters) { .bind('filterStart.pager', function(e, filters) {
$.data(table, 'pagerUpdateTriggered', false);
c.currentFilters = filters; c.currentFilters = filters;
}) })
// update pager after filter widget completes // update pager after filter widget completes
@ -466,7 +468,7 @@
if (e.type === 'filterEnd') { c.page = 0; } if (e.type === 'filterEnd') { c.page = 0; }
updatePageDisplay(table, c); updatePageDisplay(table, c);
moveToPage(table, c); moveToPage(table, c);
changeHeight(table, c); fixHeight(table, c);
}) })
.bind('disable.pager', function(){ .bind('disable.pager', function(){
showAllRows(table, c); showAllRows(table, c);
@ -544,6 +546,8 @@
hideRowsSetup(table, c); hideRowsSetup(table, c);
} }
changeHeight(table, c);
// pager initialized // pager initialized
if (!c.ajax) { if (!c.ajax) {
c.initialized = true; c.initialized = true;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* TableSorter 2.7 - Client-side table sorting with ease! * TableSorter 2.7.1 - Client-side table sorting with ease!
* @requires jQuery v1.2.6+ * @requires jQuery v1.2.6+
* *
* Copyright (c) 2007 Christian Bach * Copyright (c) 2007 Christian Bach
@ -24,7 +24,7 @@
var ts = this; var ts = this;
ts.version = "2.7"; ts.version = "2.7.1";
ts.parsers = []; ts.parsers = [];
ts.widgets = []; ts.widgets = [];
@ -879,7 +879,7 @@
// disable tablesorter // disable tablesorter
$t $t
.removeData('tablesorter') .removeData('tablesorter')
.unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave') .unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave');
c.$headers.add($f) c.$headers.add($f)
.removeClass(c.cssHeader + ' ' + c.cssAsc + ' ' + c.cssDesc) .removeClass(c.cssHeader + ' ' + c.cssAsc + ' ' + c.cssDesc)
.removeAttr('data-column'); .removeAttr('data-column');

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! tableSorter 2.4+ widgets - updated 12/26/2012 /*! tableSorter 2.4+ widgets - updated 1/4/2013
* *
* Column Styles * Column Styles
* Column Filters * Column Filters

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "tablesorter", "name": "tablesorter",
"version": "2.7", "version": "2.7.1",
"title": "tablesorter", "title": "tablesorter",
"author": { "author": {
"name": "Christian Bach", "name": "Christian Bach",