Home > Article > Web Front-end > nodejs paging class code sharing_node.js
Pagination class, I put it in plugin/Paginate.js
return (this.maxpage-1)*this.pagesize;
}
return first;
}
/*
* The maximum number of items on the current page
*/
Paginate.prototype.last = function(){
var last = this.first() this.pagesize;
if(last>this.total ){
return this.total;
}
return last;
}
/**
* Previous page
* @returns {number}
*/
Paginate.prototype.prev = function(){
return false;
}
Return this.page-1;
}
/**
* Next page
* @returns {*}
*/
Paginate.prototype.next = function(){
return false;
}
return (parseInt(this.page) 1);
}
module.exports = Paginate;
Usage examples
Copy code