通过getTotal判断more是否true
This commit is contained in:
parent
dbd52c8f26
commit
e686d60bb4
|
|
@ -1018,12 +1018,17 @@ class ListNode extends EntityNode {
|
||||||
const { data, total } = sr;
|
const { data, total } = sr;
|
||||||
assert(data);
|
assert(data);
|
||||||
const count = Object.keys(data).length;
|
const count = Object.keys(data).length;
|
||||||
|
const getTotal = this.getTotal;
|
||||||
this.pagination.more = count === this.pagination.pageSize;
|
this.pagination.more = count === this.pagination.pageSize;
|
||||||
if (typeof currentPage === 'number' && !append) {
|
if (typeof currentPage === 'number' && !append) {
|
||||||
this.pagination.currentPage = currentPage;
|
this.pagination.currentPage = currentPage;
|
||||||
}
|
}
|
||||||
if (typeof total === 'number') {
|
if (typeof total === 'number') {
|
||||||
this.pagination.total = total;
|
this.pagination.total = total;
|
||||||
|
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
|
||||||
|
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
|
||||||
|
this.pagination.more = this.pagination.currentPage + 1 < pages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
this.pagination.count += count;
|
this.pagination.count += count;
|
||||||
|
|
@ -2288,7 +2293,8 @@ export class RunningTree extends Feature {
|
||||||
// 切换分页pageSize就重新设置
|
// 切换分页pageSize就重新设置
|
||||||
return node.setPagination({
|
return node.setPagination({
|
||||||
pageSize,
|
pageSize,
|
||||||
currentPage: 0
|
currentPage: 0,
|
||||||
|
total: undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCurrentPage(path, currentPage) {
|
setCurrentPage(path, currentPage) {
|
||||||
|
|
|
||||||
|
|
@ -1021,12 +1021,17 @@ class ListNode extends EntityNode {
|
||||||
const { data, total } = sr;
|
const { data, total } = sr;
|
||||||
(0, assert_1.assert)(data);
|
(0, assert_1.assert)(data);
|
||||||
const count = Object.keys(data).length;
|
const count = Object.keys(data).length;
|
||||||
|
const getTotal = this.getTotal;
|
||||||
this.pagination.more = count === this.pagination.pageSize;
|
this.pagination.more = count === this.pagination.pageSize;
|
||||||
if (typeof currentPage === 'number' && !append) {
|
if (typeof currentPage === 'number' && !append) {
|
||||||
this.pagination.currentPage = currentPage;
|
this.pagination.currentPage = currentPage;
|
||||||
}
|
}
|
||||||
if (typeof total === 'number') {
|
if (typeof total === 'number') {
|
||||||
this.pagination.total = total;
|
this.pagination.total = total;
|
||||||
|
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
|
||||||
|
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
|
||||||
|
this.pagination.more = this.pagination.currentPage + 1 < pages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
this.pagination.count += count;
|
this.pagination.count += count;
|
||||||
|
|
@ -2291,7 +2296,8 @@ class RunningTree extends Feature_1.Feature {
|
||||||
// 切换分页pageSize就重新设置
|
// 切换分页pageSize就重新设置
|
||||||
return node.setPagination({
|
return node.setPagination({
|
||||||
pageSize,
|
pageSize,
|
||||||
currentPage: 0
|
currentPage: 0,
|
||||||
|
total: undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCurrentPage(path, currentPage) {
|
setCurrentPage(path, currentPage) {
|
||||||
|
|
|
||||||
|
|
@ -1261,12 +1261,18 @@ class ListNode<
|
||||||
const { data, total } = sr;
|
const { data, total } = sr;
|
||||||
assert(data);
|
assert(data);
|
||||||
const count = Object.keys(data).length;
|
const count = Object.keys(data).length;
|
||||||
|
const getTotal = this.getTotal;
|
||||||
this.pagination.more = count === this.pagination.pageSize;
|
this.pagination.more = count === this.pagination.pageSize;
|
||||||
if (typeof currentPage === 'number' && !append) {
|
if (typeof currentPage === 'number' && !append) {
|
||||||
this.pagination.currentPage = currentPage;
|
this.pagination.currentPage = currentPage;
|
||||||
}
|
}
|
||||||
if (typeof total === 'number') {
|
if (typeof total === 'number') {
|
||||||
this.pagination.total = total;
|
this.pagination.total = total;
|
||||||
|
|
||||||
|
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
|
||||||
|
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
|
||||||
|
this.pagination.more = this.pagination.currentPage + 1 < pages
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (append) {
|
if (append) {
|
||||||
this.pagination.count += count;
|
this.pagination.count += count;
|
||||||
|
|
@ -2775,8 +2781,9 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
// 切换分页pageSize就重新设置
|
// 切换分页pageSize就重新设置
|
||||||
return node.setPagination({
|
return node.setPagination({
|
||||||
pageSize,
|
pageSize,
|
||||||
currentPage: 0
|
currentPage: 0,
|
||||||
});
|
total: undefined,
|
||||||
|
} as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentPage<T extends keyof ED>(path: string, currentPage: number) {
|
setCurrentPage<T extends keyof ED>(path: string, currentPage: number) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue