X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FPager.js;h=2e2717727560cd86bb3d052fe026c49631fc4a8c;hb=f4fcda2f29d7c2efe91d9afabf7d5fcd4bd04b5a;hp=9ae703b07d56c17c2950331c6b0d333d8ddba094;hpb=9818631aecddd827374a0c01b3ec287e7b018bb1;p=blerg.git diff --git a/www/jssrc/blerg/Pager.js b/www/jssrc/blerg/Pager.js index 9ae703b..2e27177 100644 --- a/www/jssrc/blerg/Pager.js +++ b/www/jssrc/blerg/Pager.js @@ -1,36 +1,33 @@ enyo.kind({ - name: "blerg.Pager", - kind: "Control", - listKind: "Control", - lastRecord: null, - components: [ - {name: "records"}, - {name: "loadMoreButton", kind: "onyx.Button", onclick: "loadMore", content: "Load More"} - ], - 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; - } - this.$.records.render(); - if (this.lastRecord == 0) - this.$.loadMoreButton.hide(); - }, - loadMore: function() { - if (this.lastRecord == 0) - return; + name: "blerg.Pager", + kind: "Control", + listKind: "Control", + lastRecord: null, + components: [ + {name: "records"} + ], + 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; + } + this.$.records.render(); + }, + loadMore: function() { + if (this.lastRecord == 0) + return; - if (this.lastRecord != null) { - var to = this.lastRecord - 1; - var from = this.lastRecord - 50; - if (from < 0) - from = 0; - this.loadItems(from, to); - } else { - this.loadItems(); - } - }, - loadItems: function(from, to) { } + if (this.lastRecord != null) { + var to = this.lastRecord - 1; + var from = this.lastRecord - 50; + if (from < 0) + from = 0; + this.loadItems(from, to); + } else { + this.loadItems(); + } + }, + loadItems: function(from, to) { } });