Merge pull request #27558 from tylerd-canva/catalog-table-pagination-customization

Enable customization of CatalogTable pagination
This commit is contained in:
Ben Lambert
2024-11-12 13:38:21 -07:00
committed by GitHub
3 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Allow `OffsetPaginatedCatalogTable` to configure Table options and `CursorPaginatedCatalogTable` to configure `paginationPosition`.
@@ -39,9 +39,9 @@ export function CursorPaginatedCatalogTable(props: PaginatedCatalogTableProps) {
columns={columns}
data={data}
options={{
paginationPosition: 'both',
...options,
// These settings are configured to force server side pagination
paginationPosition: 'both',
pageSizeOptions: [],
showFirstLastPageButtons: false,
pageSize: Number.MAX_SAFE_INTEGER,
@@ -29,7 +29,7 @@ import {
export function OffsetPaginatedCatalogTable(
props: TableProps<CatalogTableRow>,
) {
const { columns, data, isLoading } = props;
const { columns, data, isLoading, options } = props;
const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =
useEntityList();
const [page, setPage] = React.useState(
@@ -53,6 +53,7 @@ export function OffsetPaginatedCatalogTable(
pageSizeOptions: [5, 10, 20, 50, 100],
pageSize: limit,
emptyRowsWhenPaging: false,
...options,
}}
onSearchChange={(searchText: string) =>
updateFilters({