Skip to content

Commit

Permalink
update paginated table to support custom page size options (#2300)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossedfort authored Sep 3, 2024
1 parent 1b8db39 commit 3010499
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/holocene/table/paginated-table/paginated.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
export let nextPageButtonLabel: string;
export let previousPageButtonLabel: string;
export let maxHeight = '';
export let pageSizeOptions: string[] = options;
$: url = $page.url;
$: perPageParam =
url.searchParams.get(perPageKey) ?? String(defaultItemsPerPage);
$: perPageParam = url.searchParams.get(perPageKey) ?? pageSizeOptions[0];
$: currentPageParam = url.searchParams.get(currentPageKey) ?? '1';
$: store = pagination(items, perPageParam, currentPageParam);
Expand All @@ -41,7 +41,7 @@
value: MAX_PAGE_SIZE,
url,
});
} else if (!options.includes(perPageParam)) {
} else if (!pageSizeOptions.includes(perPageParam)) {
updateQueryParameters({
parameter: perPageKey,
value: defaultItemsPerPage,
Expand Down Expand Up @@ -97,7 +97,7 @@
label={perPageLabel}
parameter={perPageKey}
value={perPageParam}
{options}
options={pageSizeOptions}
/>
</svelte:fragment>

Expand Down

0 comments on commit 3010499

Please sign in to comment.