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

ENYO-3219: Refresh scroll thresholds when adding / removing models #1422

Merged
merged 1 commit into from Mar 21, 2016

Conversation

graynorton
Copy link
Member

If a list is scrolled to the end and the size of the collection
changes, we need to recalculate the scroll thresholds and possibly
adjust the range of items to be rendered.

Until now, we've only adjusted thresholds in the scroll() method,
based on the direction and distance we've scrolled. In this fix, we
add a new method, refreshThresholds(), which recalculates the
thresholds based on the current scroll value. We call the new
method from modelsAdded() and modelsRemoved() to make sure that
the thresholds and item range are correct after the size of the
collection has changed.

Enyo-DCO-1.1-Signed-Off-By: Gray Norton (gray.norton@lge.com)

If a list is scrolled to the end and the size of the collection
changes, we need to recalculate the scroll thresholds and possibly
adjust the range of items to be rendered.

Until now, we've only adjusted thresholds in the `scroll()` method,
based on the direction and distance we've scrolled. In this fix, we
add a new method, `refreshThresholds()`, which recalculates the
thresholds based on the current scroll value. We call the new
method from `modelsAdded()` and `modelsRemoved()` to make sure that
the thresholds and item range are correct after the size of the
collection has changed.

Enyo-DCO-1.1-Signed-Off-By: Gray Norton (gray.norton@lge.com)
ryanjduffy added a commit that referenced this pull request Mar 21, 2016
ENYO-3219: Refresh scroll thresholds when adding / removing models

Integrated-By: Ryan Duffy (ryan.duffy@lge.com)
@ryanjduffy ryanjduffy merged commit 15d9883 into 2.6.0-dev Mar 21, 2016
@ryanjduffy ryanjduffy deleted the ENYO-3219-graynorton branch March 21, 2016 22:20
v = (this.direction === 'vertical'),
val = v ? this.scrollTop : this.scrollLeft,
delta = this.delta,
cb = this.cachedBounds ? this.cachedBounds : this._getScrollBounds(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 'scroll threshold' also updated on showing change if we update collection while data list is hidden?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KunmyonChoi, at a glance, I don't think so. I think it would be relatively straightforward to make it happen, though -- we would just override showingChangedHandler() and call refreshThresholds() before calling the super method. If you write up a JIRA demonstrating a problem case, we will take a look.

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.

None yet

3 participants