function Pagination(d){
this.data = d;
this.item = 10;
this.numPage = Math.ceil(this.data.length/this.item);
}
Pagination.prototype.setFirstPage = function(){
var arr = new Array();
for(i=0;i<this.item;i++){
arr[i] = this.data[i];
}
return arr;
}
Pagination.prototype.setLastPage = function(){
var arr = new Array();
var startLastIndex = (this.numPage-1) * this.item;
for(i=0;i<(this.data.length-startLastIndex);i++){
arr[i] = this.data[startLastIndex];
startLastIndex++;
}
return arr;
}
Pagination.prototype.next = function(){
}
Pagination.prototype.previous = function(){
}
Pagination.prototype.displayAtPage = function(n){
var arr = new Array();
n = n-1;
var startIndex = n * this.item;
for(i=0;i<(this.item);i++){
arr[i] = this.data[startIndex];
startIndex++;
}
return arr;
}
No comments:
Post a Comment