Add Tag handler. Also convert all tabs to spaces.
[blerg.git] / www / jssrc / blerg / Pager.js
1 enyo.kind({
2     name: "blerg.Pager",
3     kind: "Control",
4     listKind: "Control",
5     lastRecord: null,
6     components: [
7         {name: "records"}
8     ],
9     addItems: function(items) {
10         this.$.records.createComponents(items, {kind: this.listKind});
11         for (var i = 0; i < items.length; i++) {
12             var r = parseInt(items[i].record);
13             if (r < this.lastRecord || this.lastRecord == null)
14                 this.lastRecord = r;
15         }
16         this.$.records.render();
17     },
18     loadMore: function() {
19         if (this.lastRecord == 0)
20             return;
21
22         if (this.lastRecord != null) {
23             var to = this.lastRecord - 1;
24             var from = this.lastRecord - 50;
25             if (from < 0)
26                 from = 0;
27             this.loadItems(from, to);
28         } else {
29             this.loadItems();
30         }
31     },
32     loadItems: function(from, to) { }
33 });