Skip to content

Commit

Permalink
Fix(cellnav.js), do not trigger edit on undefined event (#6691)
Browse files Browse the repository at this point in the history
* fix(Grid.js): ScrollIfNecessary does not account for scrollWidth correctly

Since scrollIfNecessary is called multiple times when enableCellEditOnFocus is true we need to make sure the scrollbarWidth and footerHeight is accounted for to not cause a loop.

fixes #6653

* Add check for gridCol not null

Make sure gridCol is not null before checking for enableCellEditOnFocus

* fix(Grid.js) Vertical scroll calculates height wrong with enableHorizontalScrollbar: NEVER

Use scrollbarHeight instead of scrollbarWidth for vertical scroll calculations. scrollbarHeight has the value 0 when enableHorizontalScrollbar is set to NEVER.

Round calculated boundary values as computed style may have decimal number which will not match pixelsToSeeRow

* Fix(cellnav.js), do not trigger edit on undefined event

Do not trigger a cell edit when the event is undefined, if needed through API pass a null object instead.
  • Loading branch information
m4m4m4 authored and mportuga committed Apr 24, 2018
1 parent 1b01490 commit 615fe49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/features/cellnav/js/cellnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@

// Broadcast the navigation
if (gridRow !== null && gridCol !== null) {
grid.cellNav.broadcastCellNav(rowCol);
grid.cellNav.broadcastCellNav(rowCol, null, null);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/features/edit/js/gridEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
if ($scope.col.colDef.enableCellEditOnFocus) {
// Don't begin edit if the cell hasn't changed
if (newRowCol.row === $scope.row && newRowCol.col === $scope.col &&
(!evt || (evt && (evt.type === 'click' || evt.type === 'keydown')))) {
(evt === null || (evt && (evt.type === 'click' || evt.type === 'keydown')))) {
$timeout(function() {
beginEdit(evt);
});
Expand Down

0 comments on commit 615fe49

Please sign in to comment.