From 677ba67832550ca0f45d86040b6fd9b57a34450f Mon Sep 17 00:00:00 2001 From: mikebm Date: Mon, 27 Jul 2015 15:14:46 -0700 Subject: [PATCH] Re-ordered endEdit() to fix an issue with ng-model-options updateOn: 'blur' --- src/features/edit/js/gridEdit.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/features/edit/js/gridEdit.js b/src/features/edit/js/gridEdit.js index cefa3f5849..c44641ba18 100644 --- a/src/features/edit/js/gridEdit.js +++ b/src/features/edit/js/gridEdit.js @@ -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(); @@ -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() {