Skip to content

Commit

Permalink
pager now updates with updateComplete event
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Oct 25, 2012
1 parent 5a62860 commit 6d8fe95
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Binary file modified README.markdown
Binary file not shown.
12 changes: 6 additions & 6 deletions addons/pager/jquery.tablesorter.pager.js
@@ -1,6 +1,6 @@
/*!
* tablesorter pager plugin
* updated 10/17/2012
* updated 10/25/2012
*/
/*jshint browser:true, jquery:true */
;(function($) {
Expand Down Expand Up @@ -209,7 +209,7 @@
$sh = $t.find('.' + ((tc.widgetOptions && tc.widgetOptions.stickyHeaders) || 'tablesorter-stickyheader'));
$f = $t.find('tfoot tr:first').children();
$t.find('th.' + tc.cssHeader).each(function(j){
var $t = $(this), tar, icn;
var $t = $(this), icn;
// add new test within the first span it finds, or just in the header
if ( $t.find('.' + tc.cssIcon).length ) {
icn = $t.find('.' + tc.cssIcon).clone(true);
Expand Down Expand Up @@ -248,7 +248,7 @@
getAjax = function(table, c){
var $t = $(table),
url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '',
k, arry = [],
arry = [],
sl = table.config.sortList,
col = url.match(/\{sortList[\s+]?:[\s+]?(.*)\}/);
if (col) {
Expand Down Expand Up @@ -434,14 +434,14 @@
}

// update pager after filter widget completes
if ( $(table).hasClass('hasFilters') ) {
$(table).unbind('filterEnd.pager').bind('filterEnd.pager', function() {
$(table)
.unbind('filterEnd.pager updateComplete.pager ')
.bind('filterEnd.pager updateComplete.pager', function() {
c.page = 0;
updatePageDisplay(table, c);
moveToPage(table, c);
changeHeight(table, c);
});
}

if ( $(c.cssGoto, pager).length ) {
$(c.cssGoto, pager).bind('change', function(){
Expand Down
4 changes: 2 additions & 2 deletions addons/pager/jquery.tablesorter.pager.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions js/jquery.tablesorter.js
@@ -1,5 +1,5 @@
/*!
* TableSorter 2.4.5 - Client-side table sorting with ease!
* TableSorter 2.4.6 - Client-side table sorting with ease!
* @requires jQuery v1.2.6+
*
* Copyright (c) 2007 Christian Bach
Expand Down Expand Up @@ -493,10 +493,9 @@
}

function resortComplete($table, callback){
var t = $table[0];
$table.trigger('updateComplete');
if (typeof callback === "function") {
callback(t);
callback($table[0]);
}
}

Expand Down

0 comments on commit 6d8fe95

Please sign in to comment.