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

Collection Repeat With Search Input #2523

Closed

Conversation

quilligana
Copy link

See my post on the forum which outlines an issue with re-rendering a collection-repeat list following a filter being applied through a search input. If I first scroll down the list and then enter the search term, the new filtered list is not scrolled to the top. You can reproduce in this codepen. The items are all there and present but the scroll view doesn't seem to resize. If you delete the search input text and re-enter again, it all works fine as the scroll has been reset to the top of the list.

On a project I was working on, I implemented a temporary fix by adding scrollView.scrollTo(0,0, false, null, true); to the end of the renderer(value) function within the collectionRepeat directive in ionic.bundle.js.

I'm not sure if this is the best way to resolve this issue but if someone wants to advise/confirm the best solution, I will happily create a PR with a fix.

@ffalcinelli
Copy link

The workaround I was using in beta13 is to add ng-change="scrollTop()" to the input field.
But with the current master the focus is stolen from the input when the list scrolls to top, so it's no more an option I guess.

@joshbuchea
Copy link

This works great! Thanks @quilligana.

@joshbuchea
Copy link

@quilligana thanks for your efforts with this issue.

This commit solves the issue of the scrollview not resizing and items in a newly filtered list not being visible, however, it presents a new issue for me: now whenever I trigger a popover or modal to open from the view containing the list, it resets the list (scrolls to top).

I'm trying to get the list to behave properly while being filtered, AND also not lose scroll position when a modal or popup is displayed. Anyone have an idea how to solve this? Seems like maybe another check in the render function could solve this..? Any help or leads would be greatly appreciated. Thanks!

@perrygovier perrygovier assigned perrygovier and ajoslin and unassigned perrygovier Feb 9, 2015
@ajoslin ajoslin closed this in 88aebad Feb 24, 2015
@ajoslin
Copy link
Contributor

ajoslin commented Feb 24, 2015

Fixed by just making the scrollView resize when data changes. Thanks for showing the bug and explaining your solution, it helped me find this one.

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.

6 participants