Skip to content

Commit f614c75

Browse files
Introducing a local “chunkBy” method
Introducing a local “chunkBy” method to fix #22 (IE performance issues)
1 parent a55d0b1 commit f614c75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

generic-table/directive/generic-table/generic-table.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,17 @@ angular.module('angular.generic.table').directive('genericTable', function() {
198198
applyPagination();
199199
};
200200

201+
var gtChunk = function(arr, chunkSize) {
202+
var result = [];
203+
var arrSizeCache=arr.length;
204+
for (var i=0; i<arrSizeCache; i+=chunkSize)
205+
result.push(arr.slice(i,i+chunkSize));
206+
return result;
207+
};
208+
201209
// pagination, this is where we decide which subset of the data to show
202210
var applyPagination = function (){
203-
$scope.pages = $filter('chunkBy')(sortedData, parseInt($scope.gtRows));
211+
$scope.pages = gtChunk(sortedData, parseInt($scope.gtRows));
204212
$scope.currentPage = 0;
205213
$scope.loading = true;
206214
$scope.$emit('gt-started-rendering');

0 commit comments

Comments
 (0)