Fixed a bug where the pager was not constructing elements in the right positions.
This commit is contained in:
@ -3735,17 +3735,21 @@ class pager extends IgniteTemplate {
|
|||||||
|
|
||||||
//Construct the pages
|
//Construct the pages
|
||||||
if (this.pageCount > 0) {
|
if (this.pageCount > 0) {
|
||||||
|
var last = this.element;
|
||||||
|
|
||||||
//Construct the first page
|
//Construct the first page
|
||||||
var firstPage = this.renderCallback(0, this.currentPage == 0, false);
|
var firstPage = this.renderCallback(0, this.currentPage == 0, false);
|
||||||
firstPage.construct(parent, this.element);
|
firstPage.construct(parent, last);
|
||||||
this.pages.push(firstPage);
|
this.pages.push(firstPage);
|
||||||
|
last = firstPage.element;
|
||||||
|
|
||||||
//If the number of pages is less than or equal to the page range, just render all the numbers inbetween first/last.
|
//If the number of pages is less than or equal to the page range, just render all the numbers inbetween first/last.
|
||||||
if (this.pageCount <= this.pageRange) {
|
if (this.pageCount <= this.pageRange) {
|
||||||
for (var i = 1; i < this.pageCount - 1; i++) {
|
for (var i = 1; i < this.pageCount - 1; i++) {
|
||||||
var page = this.renderCallback(i, i == this.currentPage, false);
|
var page = this.renderCallback(i, i == this.currentPage, false);
|
||||||
page.construct(parent, this.element);
|
page.construct(parent, last);
|
||||||
this.pages.push(page);
|
this.pages.push(page);
|
||||||
|
last = page.element;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var leftSiblingIndex = Math.max(this.currentPage - this.pageRange, 1);
|
var leftSiblingIndex = Math.max(this.currentPage - this.pageRange, 1);
|
||||||
@ -3767,24 +3771,27 @@ class pager extends IgniteTemplate {
|
|||||||
if (shouldShowLeftDots) {
|
if (shouldShowLeftDots) {
|
||||||
var page = this.renderCallback(leftSiblingIndex - 1, false, true);
|
var page = this.renderCallback(leftSiblingIndex - 1, false, true);
|
||||||
if (page) {
|
if (page) {
|
||||||
page.construct(parent, this.element);
|
page.construct(parent, last);
|
||||||
this.pages.push(page);
|
this.pages.push(page);
|
||||||
|
last = page.element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
|
for (var i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
|
||||||
var page = this.renderCallback(i, i == this.currentPage, false);
|
var page = this.renderCallback(i, i == this.currentPage, false);
|
||||||
if (page) {
|
if (page) {
|
||||||
page.construct(parent, this.element);
|
page.construct(parent, last);
|
||||||
this.pages.push(page);
|
this.pages.push(page);
|
||||||
|
last = page.element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldShowRightDots) {
|
if (shouldShowRightDots) {
|
||||||
var page = this.renderCallback(rightSiblingIndex + 1, false, true);
|
var page = this.renderCallback(rightSiblingIndex + 1, false, true);
|
||||||
if (page) {
|
if (page) {
|
||||||
page.construct(parent, this.element);
|
page.construct(parent, last);
|
||||||
this.pages.push(page);
|
this.pages.push(page);
|
||||||
|
last = page.element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3792,8 +3799,9 @@ class pager extends IgniteTemplate {
|
|||||||
//Construct the last page if we have more than 1 page.
|
//Construct the last page if we have more than 1 page.
|
||||||
if (this.pageCount > 1) {
|
if (this.pageCount > 1) {
|
||||||
var lastPage = this.renderCallback(this.pageCount - 1, this.currentPage == this.pageCount - 1, false);
|
var lastPage = this.renderCallback(this.pageCount - 1, this.currentPage == this.pageCount - 1, false);
|
||||||
lastPage.construct(parent, this.element);
|
lastPage.construct(parent, last);
|
||||||
this.pages.push(lastPage);
|
this.pages.push(lastPage);
|
||||||
|
last = lastPage.element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user