Skip to content

Commit

Permalink
fix(infinite-scroll): Remove returns of adjustInfiniteScrollPosition.
Browse files Browse the repository at this point in the history
Update uiGridInfiniteScrollService methods so they do not return promise of `adjustInfiniteScrollPosition` when `adjustInfiniteScrollPosition` does not itself return a promise.  Also updated documentation to match code changes.
  • Loading branch information
Nathan Koterba committed Oct 14, 2015
1 parent 5886ca7 commit 156665f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/features/infinite-scroll/js/infinite-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@
* infinite scroll events upward
* @param {boolean} scrollDown flag that there are pages downwards, so
* fire infinite scroll events downward
* @returns {promise} promise that is resolved when the scroll reset is complete
*/
resetScroll: function( scrollUp, scrollDown ) {
service.setScrollDirections( grid, scrollUp, scrollDown);

return service.adjustInfiniteScrollPosition(grid, 0);
service.adjustInfiniteScrollPosition(grid, 0);
},


Expand Down Expand Up @@ -403,7 +402,6 @@
* @description This function fires 'needLoadMoreData' or 'needLoadMoreDataTop' event based on scrollDirection
* @param {Grid} grid the grid we're working on
* @param {number} scrollTop the position through the grid that we want to scroll to
* @returns {promise} a promise that is resolved when the scrolling finishes
*/
adjustInfiniteScrollPosition: function (grid, scrollTop) {
var scrollEvent = new ScrollEvent(grid, null, null, 'ui.grid.adjustInfiniteScrollPosition'),
Expand Down Expand Up @@ -437,7 +435,6 @@
* infinite scroll events upward
* @param {boolean} scrollDown flag that there are pages downwards, so
* fire infinite scroll events downward
* @returns {promise} a promise that is resolved when the scrolling finishes
*/
dataRemovedTop: function( grid, scrollUp, scrollDown ) {
var newVisibleRows, oldTop, newTop, rowHeight;
Expand All @@ -451,7 +448,7 @@
// of rows removed
newTop = oldTop - ( grid.infiniteScroll.previousVisibleRows - newVisibleRows )*rowHeight;

return service.adjustInfiniteScrollPosition( grid, newTop );
service.adjustInfiniteScrollPosition( grid, newTop );
},

/**
Expand All @@ -474,7 +471,7 @@

newTop = grid.infiniteScroll.prevScrollTop;

return service.adjustInfiniteScrollPosition( grid, newTop );
service.adjustInfiniteScrollPosition( grid, newTop );
}
};
return service;
Expand Down

0 comments on commit 156665f

Please sign in to comment.