Skip to content

Commit

Permalink
fix(Grid.js): ScrollIfNecessary does not account for scrollWidth corr…
Browse files Browse the repository at this point in the history
…ectly

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 angular-ui#6653
  • Loading branch information
macomage committed Apr 12, 2018
1 parent 464a1db commit 2ec1e70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,11 @@ angular.module('ui.grid')
// to get the full position we need
scrollPixels = self.renderContainers.body.prevScrollTop - (topBound - pixelsToSeeRow);

//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.
if (gridCol.colDef.enableCellEditOnFocus === true) {
scrollPixels = scrollPixels - self.footerHeight - self.scrollbarWidth;
}

scrollEvent.y = getScrollY(scrollPixels, scrollLength, self.renderContainers.body.prevScrolltopPercentage);
}
// Otherwise if the scroll position we need to see the row is MORE than the bottom boundary, i.e. obscured below the bottom of the self...
Expand Down

0 comments on commit 2ec1e70

Please sign in to comment.