Added check to stop the infinite list procedure if there is no more data to fetch

This commit is contained in:
Sergi Carol 2017-03-15 09:27:49 +01:00
parent 5400d16259
commit 1e08f94242
1 changed files with 10 additions and 4 deletions

View File

@ -28,9 +28,9 @@ export class InfiniteList {
method: string;
/**
* Domain of the method
* @type {string}
* @type {array}
*/
domain: string;
domain: any[];
/**
* Fields to search
* @type {Array<string>}
@ -72,10 +72,16 @@ export class InfiniteList {
* @param {any} infiniteScroll Infinite scroll event
*/
doInfinite(infiniteScroll: any) {
if (this.list_items.length == 0)
infiniteScroll.enable(false);
console.log("Begin async op");
this.loadData().then(() => {
infiniteScroll.complete()
// Disable scroll if list is empty
if (this.list_items.length == 0)
//infiniteScroll.enable(false);
console.log(this.list_items)
infiniteScroll.complete();
})
}