Skip to content

Commit

Permalink
Fixed issue angular-ui#777 where clearing the filter is slow after a …
Browse files Browse the repository at this point in the history
…sort operation. The renderedRange was incorrectly being set to the whole of the source data.
  • Loading branch information
dpangier committed Nov 15, 2013
1 parent c364028 commit edb75f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/classes/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
newRange = new ngRange(Math.max(0, rowIndex - EXCESS_ROWS), rowIndex + self.minRowsToRender() + EXCESS_ROWS);
} else {
var maxLen = $scope.configGroups.length > 0 ? self.rowFactory.parsedData.length : self.data.length;
newRange = new ngRange(0, Math.max(maxLen, self.minRowsToRender() + EXCESS_ROWS));
newRange = new ngRange(0, Math.min(maxLen, self.minRowsToRender() + EXCESS_ROWS));
}
self.prevScrollTop = scrollTop;
self.rowFactory.UpdateViewableRange(newRange);
Expand Down
1 change: 1 addition & 0 deletions src/directives/ng-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$scope.$parent.$watch(options.data, dataWatcher);
$scope.$parent.$watch(options.data + '.length', function() {
dataWatcher($scope.$eval(options.data));
$scope.adjustScrollTop(grid.$viewport.scrollTop(), true);
});
}

Expand Down

0 comments on commit edb75f0

Please sign in to comment.