ionic-framework: Ionic 2 beta 11 virtual scroll and infinite scroll autoscrolls up after update
Trying to build contact list with about 10k nodes, my assumption was to combine virtualScroll and infinite-scroll controller, so my page is like below:
<ion-content>
<ion-list [virtualScroll]="contacts">
<ion-item *virtualItem="let contact">
....
</ion-item>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfiniteInvitation($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
and .ts controller
doInfiniteInvitation(infiniteScroll) {
console.log('doInfiniteInvitation');
this.contactsService.contact_invitations()
.then(contacts => {
for (var i = 0; i < contacts.length; i++) {
this.contacts.push(contacts[i]);
}
infiniteScroll.complete();
console.log('doInfiniteInvitation done');
});
}
so after every doInfiniteInvitation call it resets to the top position, is it possible somehow avoid this “feature”? may be [virtualTrackBy]=“virtualTrack” can help with that?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (6 by maintainers)
Hey guys, I set up a repository with a simple implementation of my solution. (The solution itself is not that simple, but the demo 😉 ) It’s a custom variation of the original infinite scroll component. Scrolling back and forth with a replacement of the content to prevent DOM stuffing. As well the fetched content will scroll to the correct position after loading. The original loading spinner is replaced by a Loading component, because having the spinner on top of the list won’t work that easy. https://github.com/lujakob/ionic-infinite-scroll-example
Hey, lots of questions about this on forums and articles about virtual scroll. Any update on that? This is a must-have in many applications. Wonder how would be an Ionic’s Twitter without infinite scrolling, loading tons of useless data, or without virtualscroll leaving tons of useless data behind as you scroll…