Changeset 79
- Timestamp:
- 08/02/06 00:58:48 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
datasource.js (modified) (1 diff)
-
paginateddatasource.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/datasource.js
r66 r79 88 88 }, 89 89 90 // aliases for use with unpaginated data sources91 90 totalLength: function () { 92 91 return this.allData().length; 93 92 }, 93 94 94 allData: function () { 95 return this.theData; 95 var theData = this.theData; 96 97 if (this.dataField && theData) 98 theData = theData[this.dataField]; 99 100 return theData; 96 101 }, 97 102 -
trunk/paginateddatasource.js
r38 r79 5 5 // paginated, simply call myDataSource.makePaginated(). 6 6 DataSource.prototype.extend({ 7 makePaginated: function (opts) { 8 if (opts) 9 this.dataField = opts.dataField; 7 10 8 // returns the length of the entire data array, not just the subset on the current page9 totalLength: function () {10 return this.theData.length;11 },12 13 makePaginated: function () {14 11 this.extend({ 15 12 16 13 // returns how many pages there are 17 14 getPageCount: function () { 18 return Math.ceil(this. length() / this.itemsPerPage) || 1;15 return Math.ceil(this.totalLength() / this.getItemsPerPage()) || 1; 19 16 }, 20 17 … … 70 67 var theData = this.theData; 71 68 69 if (this.dataField && theData) { 70 theData = theData[this.dataField]; 71 } 72 72 73 if (!theData || !theData.length) 73 74 return [];
