Skip to content

Commit

Permalink
fix(edit): trigger edit when single click when set enableCellEditOnFo…
Browse files Browse the repository at this point in the history
…cus with true
  • Loading branch information
Wen Tian Zhang authored and mportuga committed Oct 31, 2017
1 parent f0b2fa7 commit bcbd843
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ You can use [rawgit.com](https://rawgit.com/)'s cdn url to access the files in t
# Angular Compatibility
UI-Grid is currently compatible with Angular versions ranging from 1.2.x to 1.4.x.
UI-Grid is currently compatible with Angular versions ranging from 1.4.x to 1.5.x.
# Feature Stability
Expand Down
4 changes: 2 additions & 2 deletions src/features/cellnav/js/cellnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,10 @@

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

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

if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col){
if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col || grid.options.enableCellEditOnFocus){
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol, originEvt);
grid.cellNav.lastRowCol = newRowCol;
}
Expand Down
4 changes: 1 addition & 3 deletions src/features/edit/js/gridEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,7 @@

cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function (newRowCol, oldRowCol, evt) {
if ($scope.col.colDef.enableCellEditOnFocus) {
// Don't begin edit if the cell hasn't changed
if ((!oldRowCol || newRowCol.row !== oldRowCol.row || newRowCol.col !== oldRowCol.col) &&
newRowCol.row === $scope.row && newRowCol.col === $scope.col) {
if (newRowCol.row === $scope.row && newRowCol.col === $scope.col && evt && (evt.type === 'click' || evt.type === 'keydown')) {
$timeout(function () {
beginEdit(evt);
});
Expand Down

0 comments on commit bcbd843

Please sign in to comment.