Skip to content

Commit 440467f

Browse files
Pass the eventOrigin from cell nav to grid edit
Fixes an issue where when all features are applied to grid and enableCellEditOnFocus is set to true the edit event would not pass the event to the beginEdit method causing issues with custom editors that rely on the type of event that triggered the cell into edit mode.
1 parent 34a7ac6 commit 440467f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

misc/tutorial/401_AllFeatures.ngdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All features are enabled to get an idea of performance
1818

1919
$scope.gridOptions = {};
2020
$scope.gridOptions.data = 'myData';
21+
$scope.gridOptions.enableCellEditOnFocus = true;
2122
$scope.gridOptions.enableColumnResizing = true;
2223
$scope.gridOptions.enableFiltering = true;
2324
$scope.gridOptions.enableGridMenu = true;

src/features/cellnav/js/cellnav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,8 @@
692692
var newRowCol = new GridRowColumn(row, col);
693693

694694
if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col){
695-
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol);
696-
grid.cellNav.lastRowCol = newRowCol;
695+
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol, originEvt);
696+
grid.cellNav.lastRowCol = newRowCol;
697697
}
698698
if (uiGridCtrl.grid.options.modifierKeysToMultiSelectCells && modifierDown) {
699699
grid.cellNav.focusedCells.push(rowCol);
@@ -757,7 +757,7 @@
757757

758758
// Scroll to the new cell, if it's not completely visible within the render container's viewport
759759
grid.scrollToIfNecessary(rowCol.row, rowCol.col).then(function () {
760-
uiGridCtrl.cellNav.broadcastCellNav(rowCol);
760+
uiGridCtrl.cellNav.broadcastCellNav(rowCol, null, evt);
761761
});
762762

763763

src/features/edit/js/gridEdit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,13 @@
528528
}
529529
});
530530

531-
cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function (newRowCol, oldRowCol) {
531+
cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function (newRowCol, oldRowCol, evt) {
532532
if ($scope.col.colDef.enableCellEditOnFocus) {
533533
// Don't begin edit if the cell hasn't changed
534534
if ((!oldRowCol || newRowCol.row !== oldRowCol.row || newRowCol.col !== oldRowCol.col) &&
535535
newRowCol.row === $scope.row && newRowCol.col === $scope.col) {
536536
$timeout(function () {
537-
beginEdit();
537+
beginEdit(evt);
538538
});
539539
}
540540
}

0 commit comments

Comments
 (0)