Ionic-framework: VirtualScroll not working with asynchronous data

Created on 11 Apr 2016  路  2Comments  路  Source: ionic-team/ionic-framework

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

Most helpful comment

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

All 2 comments

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gio82 picture gio82  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

alexbainbridge picture alexbainbridge  路  3Comments