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

VirtualScroll not working with asynchronous data #6124

Closed
Riron opened this issue Apr 11, 2016 · 2 comments
Closed

VirtualScroll not working with asynchronous data #6124

Riron opened this issue Apr 11, 2016 · 2 comments
Assignees

Comments

@Riron
Copy link

Riron commented Apr 11, 2016

Short description of the problem:

If items in a virtual list are loaded asynchronously, they don't appear.

What behavior are you expecting?

They should be displayed :)

Steps to reproduce:

  1. Create a virtualScroll list with an empty array
  2. Asyncronously load data into this array
  3. Nothing gets rendered...

What it might be after a brief look at the directive :
The ngDoCheck method only updates the list if _initis true.

  ngDoCheck() {
    if (this._init) {
      this.update(true);
    }
  } 

But this._init is only set to true on the update()method (called by ngAfterContentInit()) IF there are already elements to display. If those elements are loaded after the ngAfterContentInit() is executed, this._init will never be set to true and the items won't be rendered :

  update(checkChanges: boolean) {
    var self = this;

    if (!self._records || !self._records.length) return;

Which Ionic Version?

Ionic V2 beta 4

Plunker that shows an example of your issue

http://plnkr.co/edit/CBSEvKTQEjOhgvaoZb2I?p=preview

@agates
Copy link

agates commented Apr 11, 2016

Hah, looks like you got here right before me! Same issue here in #6125

@adamdbradley
Copy link
Contributor

Thanks for the detailed report and helping to debug this. Should be fixed in the next release.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants