diff --git a/docs/pages/Demo.tsx b/docs/pages/Demo.tsx index eab4ae0..397b02d 100644 --- a/docs/pages/Demo.tsx +++ b/docs/pages/Demo.tsx @@ -107,6 +107,7 @@ export default function Demo() { showEmpty: false, iconColor: theme.primaryColor, paginationCompactMode: false, + autoResetPageIndex: true, }); const onPageChange = (e: DataGridPaginationState) => { @@ -152,6 +153,7 @@ export default function Demo() { highlightOnHover={state.highlightOnHover} loading={state.loading} iconColor={state.iconColor} + autoResetPageIndex={state.autoResetPageIndex} onPageChange={onPageChange} onSort={onSort} onFilter={onFilter} @@ -350,17 +352,28 @@ export default function Demo() { }) } /> - {state.withPagination ? ( - - update({ - paginationCompactMode: e.target.checked, - }) - } - /> - ) : null} + {state.withPagination && ( + <> + + update({ + paginationCompactMode: e.target.checked, + }) + } + /> + + update({ + autoResetPageIndex: e.target.checked, + }) + } + /> + + )}
Font Size ({ enableRowSelection: !!withRowSelection, columnResizeMode: 'onChange', manualPagination: !!total, // when external data, handle pagination manually - autoResetPageIndex: !!autoResetPageIndex, + autoResetPageIndex: autoResetPageIndex, getCoreRowModel: getCoreRowModel(), getFilteredRowModel: getFilteredRowModel(), diff --git a/src/types.ts b/src/types.ts index 346096f..428a113 100644 --- a/src/types.ts +++ b/src/types.ts @@ -89,7 +89,7 @@ export interface DataGridProps paginationMode?: PaginationMode; /** - * If set to true, pagination will be reset to the first page when page-altering state changes eg. data is updated, filters change, grouping changes, etc. + * If set to false, pagination will NOT be reset to the first page when page-altering state changes eg. data is updated, filters change, grouping changes, etc. */ autoResetPageIndex?: boolean;