Skip to content

Commit c905f36

Browse files
authored
Merge pull request #2096 from dxc-technology/Mil4n0r/fix_resultsetTable_paginator
Added fix to cover filtering issue with paginator
2 parents 86c81c9 + a2d3c9e commit c905f36

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/lib/src/resultset-table/ResultsetTable.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ const DxcResultsetTable = ({
105105
if (!hidePaginator) {
106106
if (rows.length === 0) {
107107
changePage(0);
108-
} else if (rows.length < prevRowCountRef.current) {
109-
const lastPage = Math.ceil(rows.length / itemsPerPage);
110-
const prevLastPage = Math.ceil(prevRowCountRef.current / itemsPerPage);
111-
if (lastPage < prevLastPage) {
112-
changePage(Math.min(lastPage, page));
108+
} else {
109+
if (page === 0) {
110+
changePage(1);
111+
} else if (rows.length < prevRowCountRef.current) {
112+
const lastPage = Math.ceil(rows.length / itemsPerPage);
113+
const prevLastPage = Math.ceil(prevRowCountRef.current / itemsPerPage);
114+
if (lastPage < prevLastPage) {
115+
changePage(Math.min(lastPage, page));
116+
}
113117
}
114118
}
115119
prevRowCountRef.current = rows.length;

0 commit comments

Comments
 (0)