Pager: fix pager updating

This commit is contained in:
Mottie 2014-05-21 23:39:55 -05:00
parent 5aca5e266f
commit 219606e0db
2 changed files with 11 additions and 1 deletions

View File

@ -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){

View File

@ -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');