From 6e69bd006d7440e7e37e1f59b7ab9a8a9e1e7ba8 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 16 Feb 2021 09:39:26 +0100 Subject: [PATCH] fixing round errors in paginating (#365) fixes: #364 --- src/components/table-toolbar/PaginatingTableToolbar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/table-toolbar/PaginatingTableToolbar.tsx b/src/components/table-toolbar/PaginatingTableToolbar.tsx index 510affb015..6fe848ed2c 100644 --- a/src/components/table-toolbar/PaginatingTableToolbar.tsx +++ b/src/components/table-toolbar/PaginatingTableToolbar.tsx @@ -38,7 +38,7 @@ export const PaginatingTableToolbar = ({ inputGroupOnChange, inputGroupOnClick, }: TableToolbarProps) => { - const page = first / max; + const page = Math.round(first / max); const pagination = (variant: "top" | "bottom" = "top") => ( onNextClick((p - 1) * max)} onPreviousClick={(_, p) => onPreviousClick((p - 1) * max)} - onPerPageSelect={(_, m, f) => onPerPageSelect(f, m)} + onPerPageSelect={(_, m, f) => onPerPageSelect(f - 1, m)} variant={variant} /> );