1
0
Fork 0

fixed pagination on logs

This commit is contained in:
gschwab 2014-03-05 14:58:04 +01:00
parent 38f38a3b51
commit 1eb593ea62
1 changed files with 11 additions and 4 deletions

View File

@ -28,6 +28,7 @@
"click #logTableID_prev" : "prevTable", "click #logTableID_prev" : "prevTable",
"click #logTableID_next" : "nextTable" "click #logTableID_next" : "nextTable"
}, },
firstTable: function () { firstTable: function () {
if (this.offset !== 0) { if (this.offset !== 0) {
this.offset = 0; this.offset = 0;
@ -36,6 +37,7 @@
this.collection.fillLocalStorage(this.table, this.offset, this.size); this.collection.fillLocalStorage(this.table, this.offset, this.size);
} }
}, },
lastTable: function () { lastTable: function () {
if (this.page !== this.totalPages) { if (this.page !== this.totalPages) {
this.totalPages = Math.ceil(this.totalAmount / this.size); this.totalPages = Math.ceil(this.totalAmount / this.size);
@ -45,6 +47,7 @@
this.collection.fillLocalStorage(this.table, this.offset, this.size); this.collection.fillLocalStorage(this.table, this.offset, this.size);
} }
}, },
prevTable: function () { prevTable: function () {
if (this.offset !== 0) { if (this.offset !== 0) {
this.offset = this.offset - this.size; this.offset = this.offset - this.size;
@ -139,12 +142,14 @@
var self = this; var self = this;
var target = $('#logPaginationDiv'), var target = $('#logPaginationDiv'),
options = { options = {
left: 2, // left: 2,
right: 2, // right: 2,
page: currentPage, page: currentPage,
lastPage: totalPages, lastPage: totalPages,
click: function(i) { click: function(i) {
if (i === 1 && i !== currentPage) { var doSomething = false;
if (i === currentPage) {
} else if (i === 1 && i !== currentPage) {
self.firstTable(); self.firstTable();
} }
else if (i === totalPages && i !== currentPage) { else if (i === totalPages && i !== currentPage) {
@ -154,9 +159,10 @@
self.jumpToTable(i); self.jumpToTable(i);
} }
options.page = i; options.page = i;
target.pagination(options); // target.pagination(options);
} }
}; };
target.html("");
target.pagination(options); target.pagination(options);
$('#logPaginationDiv').prepend( $('#logPaginationDiv').prepend(
'<ul class="prePagi"><li><a id="logTableID_first" class="paginationButton">'+ '<ul class="prePagi"><li><a id="logTableID_first" class="paginationButton">'+
@ -167,6 +173,7 @@
'<span class="glyphicon glyphicon-step-forward"></span></a></li></ul>' '<span class="glyphicon glyphicon-step-forward"></span></a></li></ul>'
); );
}, },
drawTable: function () { drawTable: function () {
var self = this; var self = this;