Skip to content

Commit

Permalink
fix(Filter): Watch running w/o change check
Browse files Browse the repository at this point in the history
The filter term watches were all firing whether or not there was a change
to the values!
  • Loading branch information
c0bra committed Nov 13, 2014
1 parent 1182b05 commit 79f6c21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/features/edit/js/gridEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@

var cellElement;
$scope.$apply(function () {
debugger;
inEdit = true;
cancelBeginEditEvents();
var cellElement = angular.element(html);
Expand Down Expand Up @@ -677,8 +676,6 @@
});

$elm.on('keydown', function (evt) {
// debugger;

switch (evt.keyCode) {
case uiGridConstants.keymap.ESC:
evt.stopPropagation();
Expand Down
18 changes: 10 additions & 8 deletions src/js/core/directives/ui-grid-header-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,16 @@
var filterDeregisters = [];
angular.forEach($scope.col.filters, function(filter, i) {
filterDeregisters.push($scope.$watch('col.filters[' + i + '].term', function(n, o) {
uiGridCtrl.grid.api.core.raise.filterChanged();
uiGridCtrl.grid.refresh()
.then(function () {
if (uiGridCtrl.prevScrollArgs && uiGridCtrl.prevScrollArgs.y && uiGridCtrl.prevScrollArgs.y.percentage) {
uiGridCtrl.fireScrollingEvent({ y: { percentage: uiGridCtrl.prevScrollArgs.y.percentage } });
}
// uiGridCtrl.fireEvent('force-vertical-scroll');
});
if (n !== o) {
uiGridCtrl.grid.api.core.raise.filterChanged();
uiGridCtrl.grid.refresh()
.then(function () {
if (uiGridCtrl.prevScrollArgs && uiGridCtrl.prevScrollArgs.y && uiGridCtrl.prevScrollArgs.y.percentage) {
uiGridCtrl.fireScrollingEvent({ y: { percentage: uiGridCtrl.prevScrollArgs.y.percentage } });
}
// uiGridCtrl.fireEvent('force-vertical-scroll');
});
}
}));
});
$scope.$on('$destroy', function() {
Expand Down

0 comments on commit 79f6c21

Please sign in to comment.