Skip to content

Commit 13bf807

Browse files
committed
fix(pagination): Refactor 'getLastRowIndex' to call 'getFirstRowIndex'
instead of calling reduce another time.
1 parent 5088057 commit 13bf807

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/features/pagination/js/pagination.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@
8787
*/
8888
getLastRowIndex: function () {
8989
if (grid.options.useCustomPagination) {
90-
return grid.options.paginationPageSizes.reduce(function(result, size, index) {
91-
return index <= grid.options.paginationCurrentPage - 1 ? result + size : result;
92-
}, 0);
90+
return publicApi.methods.pagination.getFirstRowIndex() + grid.options.paginationPageSizes[grid.options.paginationCurrentPage - 1];
9391
}
9492
return Math.min(grid.options.paginationCurrentPage * grid.options.paginationPageSize, grid.options.totalItems);
9593
},

0 commit comments

Comments
 (0)