Skip to content

Commit bcbd843

Browse files
Wen Tian Zhangmportuga
Wen Tian Zhang
authored andcommitted
fix(edit): trigger edit when single click when set enableCellEditOnFocus with true
1 parent f0b2fa7 commit bcbd843

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You can use [rawgit.com](https://rawgit.com/)'s cdn url to access the files in t
5252
5353
# Angular Compatibility
5454
55-
UI-Grid is currently compatible with Angular versions ranging from 1.2.x to 1.4.x.
55+
UI-Grid is currently compatible with Angular versions ranging from 1.4.x to 1.5.x.
5656
5757
# Feature Stability
5858

src/features/cellnav/js/cellnav.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,10 @@
688688

689689
var rowColSelectIndex = uiGridCtrl.grid.api.cellNav.rowColSelectIndex(rowCol);
690690

691-
if (grid.cellNav.lastRowCol === null || rowColSelectIndex === -1) {
691+
if (grid.cellNav.lastRowCol === null || rowColSelectIndex === -1 || (grid.cellNav.lastRowCol.col === col && grid.cellNav.lastRowCol.row === row)) {
692692
var newRowCol = new GridRowColumn(row, col);
693693

694-
if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col){
694+
if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col || grid.options.enableCellEditOnFocus){
695695
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol, originEvt);
696696
grid.cellNav.lastRowCol = newRowCol;
697697
}

src/features/edit/js/gridEdit.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,7 @@
534534

535535
cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function (newRowCol, oldRowCol, evt) {
536536
if ($scope.col.colDef.enableCellEditOnFocus) {
537-
// Don't begin edit if the cell hasn't changed
538-
if ((!oldRowCol || newRowCol.row !== oldRowCol.row || newRowCol.col !== oldRowCol.col) &&
539-
newRowCol.row === $scope.row && newRowCol.col === $scope.col) {
537+
if (newRowCol.row === $scope.row && newRowCol.col === $scope.col && evt && (evt.type === 'click' || evt.type === 'keydown')) {
540538
$timeout(function () {
541539
beginEdit(evt);
542540
});

0 commit comments

Comments
 (0)