From 50a1478fff8f001e9e618995eb79db4fbff0e8f2 Mon Sep 17 00:00:00 2001 From: gabmed Date: Fri, 18 Dec 2015 15:08:17 -0200 Subject: [PATCH 1/2] Update person.js // Watch the whole sortInfo variable not only fields. That way it catches sort directions refreshing too --- src/main/webapp/script/person.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/script/person.js b/src/main/webapp/script/person.js index a8e0633..def5132 100644 --- a/src/main/webapp/script/person.js +++ b/src/main/webapp/script/person.js @@ -48,7 +48,7 @@ app.controller('personsListController', function ($scope, $rootScope, personServ // Watch the sortInfo variable. If changes are detected than we need to refresh the grid. // This also works for the first page access, since we assign the initial sorting in the initialize section. - $scope.$watch('sortInfo.fields[0]', function () { + $scope.$watch('sortInfo', function () { $scope.refreshGrid(); }, true); From 367e22f13f01d3961be7a5ea094d38285720b652 Mon Sep 17 00:00:00 2001 From: gabmed Date: Fri, 18 Dec 2015 15:26:51 -0200 Subject: [PATCH 2/2] Update person.js Reset list to page 1 after changes on SortInfo --- src/main/webapp/script/person.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/script/person.js b/src/main/webapp/script/person.js index def5132..58ecbaa 100644 --- a/src/main/webapp/script/person.js +++ b/src/main/webapp/script/person.js @@ -49,6 +49,7 @@ app.controller('personsListController', function ($scope, $rootScope, personServ // Watch the sortInfo variable. If changes are detected than we need to refresh the grid. // This also works for the first page access, since we assign the initial sorting in the initialize section. $scope.$watch('sortInfo', function () { + $scope.persons = {currentPage: 1}; $scope.refreshGrid(); }, true);