diff --git a/packages/react-formio/src/components/pagination/pagination.component.spec.tsx b/packages/react-formio/src/components/pagination/pagination.component.spec.tsx
index c553fc9d..0b474f5d 100644
--- a/packages/react-formio/src/components/pagination/pagination.component.spec.tsx
+++ b/packages/react-formio/src/components/pagination/pagination.component.spec.tsx
@@ -111,4 +111,12 @@ describe("Pagination", () => {
expect(selectComp).toBeInTheDocument();
expect(selectChilds.length === pageSizes.length).toBeTruthy();
});
+
+ it("should display total length", () => {
+ const pageSizes = [10, 25, 50, 100, 200, 500];
+
+ render();
+
+ expect(screen.getByTestId("pagination-total-items")).toHaveTextContent("1,000 items");
+ });
});
diff --git a/packages/react-formio/src/components/pagination/pagination.component.tsx b/packages/react-formio/src/components/pagination/pagination.component.tsx
index 101fa598..2e114974 100644
--- a/packages/react-formio/src/components/pagination/pagination.component.tsx
+++ b/packages/react-formio/src/components/pagination/pagination.component.tsx
@@ -38,7 +38,7 @@ export interface PaginationProps {
canNextPage: boolean;
pageCount: number;
pageIndex: number;
- pageOptions?: any;
+ pageOptions?: number[];
pageSize: number;
setPageSize: any;
totalLength?: number;
@@ -117,7 +117,7 @@ export function Pagination(props: PaginationProps) {
{i18n("items per page")}
{pageOptions && (
-
+
{i18n("Page")}
{pageIndex + 1} of {pageOptions.length}
@@ -129,6 +129,11 @@ export function Pagination(props: PaginationProps) {
)}
)}
+ {totalLength !== undefined && (
+
+ {i18n("Totals")}: {new Intl.NumberFormat(undefined).format(totalLength)} {i18n("items")}
+
+ )}
);
}
diff --git a/packages/react-formio/src/components/table/hooks/useCustomTable.hook.tsx b/packages/react-formio/src/components/table/hooks/useCustomTable.hook.tsx
index 9520a0d6..0e53d429 100644
--- a/packages/react-formio/src/components/table/hooks/useCustomTable.hook.tsx
+++ b/packages/react-formio/src/components/table/hooks/useCustomTable.hook.tsx
@@ -1,17 +1,6 @@
import noop from "lodash/noop";
import React, { PropsWithChildren, useEffect, useState } from "react";
-import {
- CellProps,
- FilterProps,
- Renderer,
- TableInstance,
- TableOptions,
- useFilters,
- useGroupBy,
- usePagination,
- useSortBy,
- useTable
-} from "react-table";
+import { CellProps, FilterProps, Renderer, TableOptions, useFilters, useGroupBy, usePagination, useSortBy, useTable } from "react-table";
import { OnClickOperation, Operation, QueryOptions } from "../../../interfaces";
import { Pagination as DefaultPagination } from "../../pagination/pagination.component";