Skip to content

Commit

Permalink
fix: table pagination count
Browse files Browse the repository at this point in the history
  • Loading branch information
tonai committed Nov 13, 2023
1 parent ec53f2c commit f85945e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/react-front-kit-table/src/Components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function Table<Data extends Record<string, unknown>>(
rowActionNumber = 0,
...mantineTableProps
} = props;
const { enablePagination = true, data, manualPagination } = mantineTableProps;
const { enablePagination = true, manualPagination } = mantineTableProps;
const { classes } = useStyles();
const [confirmAction, setConfirmAction] =
useState<IConfirmAction<Data> | null>(null);
Expand Down Expand Up @@ -319,7 +319,7 @@ export function Table<Data extends Record<string, unknown>>(
},
...mantineTableProps,
});
const { getState, setPageIndex, setPageSize } = table;
const { getPageCount, getState, setPageIndex, setPageSize } = table;
const { pagination } = getState();
const { pageIndex, pageSize } = pagination;

Expand All @@ -344,7 +344,7 @@ export function Table<Data extends Record<string, unknown>>(
onItemsPerPageChange={handleItemsPerPageChange}
onPageChange={handlePageChange}
page={pageIndex + 1}
totalPages={Math.ceil(data.length / pageSize)}
totalPages={getPageCount()}
/>
) : (
paginationProps !== undefined && (
Expand Down
3 changes: 2 additions & 1 deletion packages/react-front-kit-table/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "tsconfig/react-library.json"
"extends": "tsconfig/react-library.json",
"include": [".", "../../global.d.ts"]
}

0 comments on commit f85945e

Please sign in to comment.