Fix upper page bound calculation

pull/976/head
Till Breuer 11 years ago
parent 18ac679e61
commit eaaf0eed5e
  1. 10
      app/assets/javascripts/angular/directives/components/table_pagination.js

@ -24,9 +24,17 @@ angular.module('openproject.uiComponents')
};
updateCurrentRange = function() {
scope.currentRange = "(" + ((scope.perPage * (scope.page - 1)) + 1) + " - " + scope.rows.length + "/" + scope.totalEntries + ")";
scope.currentRange = "(" + getLowerPageBound(scope.page, scope.perPage) + " - " + getUpperPageBound(scope.page, scope.perPage) + "/" + scope.totalEntries + ")";
};
function getLowerPageBound(page, perPage) {
return perPage * (page - 1) + 1;
}
function getUpperPageBound(page, perPage) {
return Math.min(perPage * page, scope.totalEntries);
}
updatePageNumbers = function() {
var pageNumbers = [];
for (var i = 1; i <= Math.ceil(scope.totalEntries / scope.perPage); i++) {

Loading…
Cancel
Save