Skip to content

Commit

Permalink
Merge pull request #4058 from mikebm/master
Browse files Browse the repository at this point in the history
Fixed ng-model-options="{ updateOn: 'blur'}" on custom edit templates
  • Loading branch information
swalters committed Jul 31, 2015
2 parents 2d4fb97 + 677ba67 commit 69f0a80
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/features/edit/js/gridEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,14 @@
if (!inEdit) {
return;
}

//sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus
//back to grid here. The focus call needs to be before the $destroy and removal of the control,
//otherwise ng-model-options of UpdateOn: 'blur' will not work.
if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
uiGridCtrl.focus();
}

var gridCellContentsEl = angular.element($elm.children()[0]);
//remove edit element
editCellScope.$destroy();
Expand All @@ -790,11 +798,6 @@
inEdit = false;
registerBeginEditEvents();
$scope.grid.api.core.notifyDataChange( uiGridConstants.dataChange.EDIT );
//sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus
//back to grid here
if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
uiGridCtrl.focus();
}
}

function cancelEdit() {
Expand Down

0 comments on commit 69f0a80

Please sign in to comment.