Skip to content

Commit

Permalink
fix(pagination): Refactor 'getLastRowIndex' to call 'getFirstRowIndex'
Browse files Browse the repository at this point in the history
instead of calling reduce another time.
  • Loading branch information
chatcher committed Feb 29, 2016
1 parent 5088057 commit 13bf807
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/features/pagination/js/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@
*/
getLastRowIndex: function () {
if (grid.options.useCustomPagination) {
return grid.options.paginationPageSizes.reduce(function(result, size, index) {
return index <= grid.options.paginationCurrentPage - 1 ? result + size : result;
}, 0);
return publicApi.methods.pagination.getFirstRowIndex() + grid.options.paginationPageSizes[grid.options.paginationCurrentPage - 1];
}
return Math.min(grid.options.paginationCurrentPage * grid.options.paginationPageSize, grid.options.totalItems);
},
Expand Down

0 comments on commit 13bf807

Please sign in to comment.