diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 7eed6923..27bd6efa 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -726,6 +726,11 @@ }) .bind('update updateRows updateAll addRows '.split(' ').join('.pager '), function(e){ e.stopPropagation(); + fixHeight(table, p); + var $rows = c.$tbodies.eq(0).children(); + p.totalRows = $rows.length - ( p.countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length ); + p.totalPages = Math.ceil( p.totalRows / p.size ); + updatePageDisplay(table, p); hideRows(table, p); }) .bind('pageSize.pager', function(e,v){ diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 6fca179d..ce9500d6 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -131,7 +131,6 @@ tsp = ts.pager = { filteredPages: 0, currentFilters: [], page: wo.pager_startPage, - size: wo.pager_size, startRow: 0, endRow: 0, ajaxCounter: 0, @@ -147,6 +146,7 @@ tsp = ts.pager = { ts.log('Pager initializing'); } + p.size = $.data(table, 'pagerLastSize') || wo.pager_size; // added in case the pager is reinitialized after being destroyed. p.$container = $(s.container).addClass(wo.pager_css.container).show(); // goto selector @@ -246,6 +246,11 @@ tsp = ts.pager = { }) .on('update updateRows updateAll addRows '.split(' ').join('.pager '), function(e){ e.stopPropagation(); + tsp.fixHeight(table, c); + var $rows = c.$tbodies.eq(0).children(); + p.totalRows = $rows.length - ( c.widgetOptions.pager_countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length ); + p.totalPages = Math.ceil( p.totalRows / p.size ); + tsp.updatePageDisplay(table, c); tsp.hideRows(table, c); // make sure widgets are applied - fixes #450 c.$table.trigger('applyWidgets');