From e80fc7f941b1ee093909d71ad292390e194a66fe Mon Sep 17 00:00:00 2001 From: rian mandala <60568628+rianmandala@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:25:02 +0700 Subject: [PATCH] feat(TableV2): expose initial pageIndex and pageSize (#61) --- packages/apsara-ui/src/TableV2/Table.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/apsara-ui/src/TableV2/Table.tsx b/packages/apsara-ui/src/TableV2/Table.tsx index 8baf0175..477a0fa0 100644 --- a/packages/apsara-ui/src/TableV2/Table.tsx +++ b/packages/apsara-ui/src/TableV2/Table.tsx @@ -36,6 +36,8 @@ interface ITableProps { isLoading?: boolean; height?: string; enableRowSelection?: boolean; + initialPageSize?: number; + initialPageIndex?: number; } function Table({ @@ -54,6 +56,8 @@ function Table({ alternate = false, alternateHover = false, enableRowSelection = false, + initialPageIndex = 1, + initialPageSize = 100, }: ITableProps) { const columns: any[] = []; const columnHelper = createColumnHelper(); @@ -69,8 +73,8 @@ function Table({ const [sorting, setSorting] = React.useState([]); const [{ pageIndex, pageSize }, setPagination] = React.useState({ - pageIndex: 1, - pageSize: 100, + pageIndex: initialPageIndex, + pageSize: initialPageSize, }); const fetchDataOptions = {