fixing round errors in paginating (#365)

fixes: #364
This commit is contained in:
Erik Jan de Wit 2021-02-16 09:39:26 +01:00 committed by GitHub
parent 80cca9eca4
commit 6e69bd006d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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") => (
<Pagination
isCompact
@ -52,7 +52,7 @@ export const PaginatingTableToolbar = ({
perPage={max}
onNextClick={(_, p) => 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}
/>
);