Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Infinite Scroll Up #2730

Merged
merged 1 commit into from
Feb 9, 2015
Merged

Enable Infinite Scroll Up #2730

merged 1 commit into from
Feb 9, 2015

Conversation

mloutraris-ge
Copy link
Contributor

Additionally fix display issue for infinite scroll 'blank block' #2535

Code changes enable infinite scroll up. Changes are as follows:

File: misc/tutorial/212_infinite_scroll.ngdoc
Update documentation to load the data for up and adjust the load data
for down to append to exiting data, not overwrite the hashKeys

src/features/infinite-scroll/js/infinite-scroll.js
Updated file to add new needLoadMoreDataTop method and supporting code
to call method.

src/features/infinite-scroll/test/infiniteScroll.spec.js
Updated unit test to test for needMoreLoadDataTop

src/js/core/constants.js
Added new constant for scroll direction

src/js/core/directives/ui-grid-viewport.js
Added supporting logic to set scroll direction properly

src/js/core/directives/ui-grid.js
Added new function to adjust scroll position after an infinite scroll
data load up or down.

src/js/core/factories/Grid.js
Added logic to reset scroll direction to none after a debounce as well
as increased debounce to 1000 to allow for timeout added to reset scroll
position to execute

src/js/core/factories/GridRenderContainer.js
Added logic too datawatch function to calculate the row to scroll to
after a data load. The up scroll is tricky because you ahve to find the
row you were on in the new data array. This was done by searching for
the hashKey of the row we were on. Supporting code was also added. The
"blank block" issue was fixed here by allowing the logic to execute if
infinite scroll is enabled.

…blank block' #2535

Code changes enable infinite scroll up. Changes are as follows:

File: misc/tutorial/212_infinite_scroll.ngdoc
Update documentation to load the data for up and adjust the load data
for down to append to exiting data, not overwrite the hashKeys

src/features/infinite-scroll/js/infinite-scroll.js
Updated file to add new needLoadMoreDataTop method and supporting code
to call method.

src/features/infinite-scroll/test/infiniteScroll.spec.js
Updated unit test to test for needMoreLoadDataTop

src/js/core/constants.js
Added new constant for scroll direction

src/js/core/directives/ui-grid-viewport.js
Added supporting logic to set scroll direction properly

src/js/core/directives/ui-grid.js
Added new function to adjust scroll position after an infinite scroll
data load up or down.

src/js/core/factories/Grid.js
Added logic to reset scroll direction to none after a debounce as well
as increased debounce to 1000 to allow for timeout added to reset scroll
position to execute

src/js/core/factories/GridRenderContainer.js
Added logic too datawatch function to calculate the row to scroll to
after a data load. The up scroll is tricky because you ahve to find the
row you were on in the new data array. This was done by searching for
the hashKey of the row we were on. Supporting code was also added. The
"blank block" issue was fixed here by allowing the logic to execute if
infinite scroll is enabled.
@PaulL1
Copy link
Contributor

PaulL1 commented Feb 9, 2015

This code looks clean and well documented, and has unit tests, thanks for that.

I can see it fiddles with the scrolling a little bit, @swalters you may want to cast an eye over that, it has a specific if clause that checks for infinite scroll being enabled, but I'm aware that we had problems with blank rows in other situations than just infinite scroll - maybe that code should be generalised?

Given the code is localised to infinite scroll - merging.

PaulL1 added a commit that referenced this pull request Feb 9, 2015
@PaulL1 PaulL1 merged commit 4a647b7 into angular-ui:master Feb 9, 2015
@PaulL1 PaulL1 self-assigned this Mar 16, 2015
PaulL1 added a commit to PaulL1/ng-grid that referenced this pull request Mar 23, 2015
…NG changes

Substantial refactor of infinite scroll.  Provides new functionality, a much more
detailed tutorial, and removes the code that crept into core in angular-ui#2730 (which I merged
when I shouldn't have).  Clarifies the handling, removes a viewPort directive that was
unnecessary, makes the handling for scroll up and down consistent.

Strictly speaking the API hasn't changed, but there are some new settings and the
default behaviour has subtly changed in that scrollUp isn't enabled by default.  This
should be more logical to users, but probably does require a review of the tutorial and API.
PaulL1 added a commit that referenced this pull request Mar 23, 2015
Fix(infiniteScroll): fix #2730, fix #2827, BREAKING changes
@PaulL1
Copy link
Contributor

PaulL1 commented Mar 23, 2015

Note that a chunk of this code has been backed out so as to remove the infiniteScroll logic that had crept into core. However, the concepts and intent I think have been retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants