From 13bf80796e0e8b60109c6875de26c6c5bdeb2c8d Mon Sep 17 00:00:00 2001 From: Chad Hatcher Date: Sun, 28 Feb 2016 16:41:46 -0800 Subject: [PATCH] fix(pagination): Refactor 'getLastRowIndex' to call 'getFirstRowIndex' instead of calling reduce another time. --- src/features/pagination/js/pagination.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/features/pagination/js/pagination.js b/src/features/pagination/js/pagination.js index 2c30fdf5b8..69477874e9 100644 --- a/src/features/pagination/js/pagination.js +++ b/src/features/pagination/js/pagination.js @@ -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); },