Skip to content

Commit

Permalink
Re-ordered endEdit() to fix an issue with ng-model-options updateOn: …
Browse files Browse the repository at this point in the history
…'blur'
  • Loading branch information
mikebm authored and unknown committed Jul 30, 2015
1 parent 2d4fb97 commit 677ba67
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 677ba67

Please sign in to comment.