From 1407038b206a8cdc4590d84d079ed22b3d087853 Mon Sep 17 00:00:00 2001 From: Benjamin Orozco Date: Thu, 13 Aug 2015 17:43:09 -0500 Subject: [PATCH] fix(pagination): avoid initial double firing of `paginationChanged` 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: https://github.com/michaelbromley/angularUtils/issues/212 --- src/features/pagination/js/pagination.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/pagination/js/pagination.js b/src/features/pagination/js/pagination.js index 21ab523299..2f225f9927 100644 --- a/src/features/pagination/js/pagination.js +++ b/src/features/pagination/js/pagination.js @@ -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; }