X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FPager.js;h=f311d1f60a7a4e92a947ee2699766d3638ec63cd;hb=b1acd335f975b9553e68cb66c81eef117821d296;hp=2e2717727560cd86bb3d052fe026c49631fc4a8c;hpb=80ad774f55998cc11e08694245dfd6cb1b49a86f;p=blerg.git diff --git a/www/jssrc/blerg/Pager.js b/www/jssrc/blerg/Pager.js index 2e27177..f311d1f 100644 --- a/www/jssrc/blerg/Pager.js +++ b/www/jssrc/blerg/Pager.js @@ -4,16 +4,22 @@ enyo.kind({ listKind: "Control", lastRecord: null, components: [ - {name: "records"} + {name: "records"}, + {name: "spinner", kind: "OldSchoolSpinner", showing: false} ], addItems: function(items) { - this.$.records.createComponents(items, {kind: this.listKind}); - for (var i = 0; i < items.length; i++) { - var r = parseInt(items[i].record); - if (r < this.lastRecord || this.lastRecord == null) - this.lastRecord = r; + if (items.length > 0) { + this.$.records.createComponents(items, {kind: this.listKind}); + for (var i = 0; i < items.length; i++) { + var r = parseInt(items[i].record); + if (r < this.lastRecord || this.lastRecord == null) + this.lastRecord = r; + } + } else { + this.$.records.createComponent({content: "No items"}); } this.$.records.render(); + this.stopLoadAnimation(); }, loadMore: function() { if (this.lastRecord == 0) @@ -29,5 +35,15 @@ enyo.kind({ this.loadItems(); } }, - loadItems: function(from, to) { } + loadItems: function(from, to) { + this.startLoadAnimation(); + }, + startLoadAnimation: function() { + this.$.spinner.show(); + this.$.spinner.start(); + }, + stopLoadAnimation: function() { + this.$.spinner.hide(); + this.$.spinner.stop(); + } });