diff --git a/packages/nc-gui-v2/components/smartsheet/Pagination.vue b/packages/nc-gui-v2/components/smartsheet/Pagination.vue index 1dfe4dc850..f219f8dbbb 100644 --- a/packages/nc-gui-v2/components/smartsheet/Pagination.vue +++ b/packages/nc-gui-v2/components/smartsheet/Pagination.vue @@ -11,25 +11,7 @@ const count = computed(() => paginatedData.value?.totalRows ?? Infinity) const size = computed(() => paginatedData.value?.pageSize ?? 25) const page = computed({ - get: () => { - // if current page is undefined, then show page 1 by default - if (!paginatedData?.value?.page) return 1 - console.log("count=" + count.value) - console.log("size=" + size.value) - console.log("paginatedData.value.page=" + paginatedData.value.page) - - // the maximum possible page given the current count and the size - const mxPage = Math.ceil(count.value / size.value) - // calculate targetPage where 1 <= targetPage <= mxPage - const targetPage = Math.max(1, Math.min(mxPage, paginatedData.value.page)) - // if the current page is greater than targetPage, - // then the page should be changed instead of showing an empty page - // e.g. deleting all records in the last page N should return N - 1 page - if (paginatedData.value.page > targetPage) { - changePage?.(targetPage) - } - return targetPage - }, + get: () => paginatedData?.value?.page ?? 1, set: (p) => changePage?.(p), }) @@ -42,10 +24,6 @@ const page = computed({
- count : {{ count }} - page: {{ page }} - size: {{ size }} -