pagination

This commit is contained in:
张磊 2015-06-19 11:39:38 +08:00
parent 22310e5cec
commit b6037587da
1 changed files with 7 additions and 7 deletions

View File

@ -54,13 +54,6 @@
}, this.option);
this.pageNum = Math.ceil(this.option.total / this.option.pageSize);
},
getInterval: function () {
var ne_half = Math.ceil(this.option.numDisplay / 2);
var upper_limit = this.pageNum - this.option.numDisplay;
var start = this.option.currentPage > ne_half ? Math.max(Math.min(this.option.currentPage - ne_half, upper_limit), 0) : 0;
var end = this.option.currentPage > ne_half ? Math.min(this.option.currentPage + ne_half, this.pageNum) : Math.min(this.option.numDisplay, this.pageNum);
return [start, end];
},
onRefresh: function () {
if (this.option.currentPage > 0) {
this.prev.addEventListener("click", function (evt) {
@ -123,6 +116,13 @@
tpl += '</div>';
return tpl;
},
getInterval: function () {
var ne_half = Math.ceil(this.option.numDisplay / 2);
var upper_limit = this.pageNum - this.option.numDisplay;
var start = this.option.currentPage > ne_half ? Math.max(Math.min(this.option.currentPage - ne_half, upper_limit), 0) : 0;
var end = this.option.currentPage > ne_half ? Math.min(this.option.currentPage + ne_half, this.pageNum) : Math.min(this.option.numDisplay, this.pageNum);
return [start, end];
},
getPrev: function () {
if (this.option.currentPage === 0) {
return '<span nc-id="prev" class="current prev">{{prevText}}</span>';