Skip to content

Commit

Permalink
Fixed the pagination bug. (#16)
Browse files Browse the repository at this point in the history
* Updated the total count after insert data and delete data, and fixed the pagination bug.

* Fixed coding style for hapi.
  • Loading branch information
starlightslo committed Jan 21, 2017
1 parent 61c8e04 commit 0e8b389
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion public/managerui/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ dbManagerAppController.controller('MainController', ($rootScope, $scope, $http,
DBService.setDataList(data.data);
$scope.dataList = DBService.getDataList();

// getting total count from selected table
$scope.getTotalCount();

// Reset the new data value
$scope.newData = {};

Expand Down Expand Up @@ -488,6 +491,9 @@ dbManagerAppController.controller('MainController', ($rootScope, $scope, $http,
DBService.setDataList(data.data);
$scope.dataList = DBService.getDataList();

// getting total count from selected table
$scope.getTotalCount();

// Reset the new data value
$scope.selectedData = {};

Expand Down Expand Up @@ -827,7 +833,14 @@ dbManagerAppController.controller('MainController', ($rootScope, $scope, $http,
$scope.totalCount = DBService.getTotalCount();

// Set up total page
$scope.totalPage = Math.ceil($scope.totalCount / $scope.displayRows);
if ($scope.totalCount > 0) {
$scope.totalPage = Math.ceil($scope.totalCount / $scope.displayRows);
}
else {
$scope.totalPage = 1;
}

// Set up the page array for display
$scope.totalPageArray = [];
for (let i = 1; i <= $scope.totalPage; ++i) {
$scope.totalPageArray.push(i);
Expand Down

0 comments on commit 0e8b389

Please sign in to comment.