Skip to content

Commit

Permalink
fix(pagination): avoid initial double firing of paginationChanged
Browse files Browse the repository at this point in the history
When initially loading a grid with `ui.grid.pagination` enabled, **paginationChanged** is triggered two times since the watcher values transition from `undefined` to the **initial value**

Found while developing a `pageSize` feature on an alternate pagination project: michaelbromley/angularUtils#212
  • Loading branch information
benoror committed Aug 13, 2015
1 parent b6faacc commit 1407038
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/features/pagination/js/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
var deregT = $scope.$watch('grid.options.totalItems + grid.options.paginationPageSize', setShowing);

var deregP = $scope.$watch('grid.options.paginationCurrentPage + grid.options.paginationPageSize', function (newValues, oldValues) {
if (newValues === oldValues) {
if (newValues === oldValues || oldValues === undefined) {
return;
}

Expand Down

0 comments on commit 1407038

Please sign in to comment.