) {
+ const rowOptions = [50, 100, 200]
+
+ const searchParams = useSearchParams();
+ const rows = searchParams.get("rows");
+ const queryParams = useQueryParams({ rows: "50" });
+
+ useEffect(() => {
+ if (rowOptions.includes(Number(rows))) {
+ table.setPageSize(Number(rows))
+ return
+ }
+ table.setPageSize(rowOptions[0])
+ }, []);
+
return (
{/* Left-aligned content */}
@@ -26,9 +43,10 @@ export function DataTablePagination({
value={table.getState().pagination.pageSize}
onChange={(e) => {
table.setPageSize(Number(e.target.value));
+ queryParams.rows(e.target.value);
}}
>
- {[50, 100, 200].map((pageSize) => (
+ {rowOptions.map((pageSize) => (