Closes #173: fix pagination default page size

This commit is contained in:
Benjamin Gamard 2018-01-01 23:24:24 +01:00
parent 66d331ddb8
commit 6d865af15a

View File

@ -11,7 +11,7 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim
$scope.asc = false; $scope.asc = false;
$scope.offset = 0; $scope.offset = 0;
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? 10 : localStorage.documentsPageSize; $scope.limit = _.isUndefined(localStorage.documentsPageSize) ? '10' : localStorage.documentsPageSize;
$scope.search = $state.params.search ? $state.params.search : ''; $scope.search = $state.params.search ? $state.params.search : '';
$scope.searchOpened = false; $scope.searchOpened = false;
$scope.setSearch = function (search) { $scope.search = search }; $scope.setSearch = function (search) { $scope.search = search };
@ -57,7 +57,7 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim
if (prev === next) { if (prev === next) {
return; return;
} }
$scope.offset = ($scope.currentPage - 1) * $scope.limit; $scope.offset = ($scope.currentPage - 1) * parseInt($scope.limit);
$scope.pageDocuments(); $scope.pageDocuments();
}); });