From 2c593b95dd34d58315fc0094453d89eff26bb03a Mon Sep 17 00:00:00 2001 From: Sina Javaheri Date: Tue, 15 Oct 2024 14:28:25 +0200 Subject: [PATCH] fix(inventory-table): fix pagination not show on less than 2 pages --- .../panel/inventory/DataGridPagination.tsx | 82 ++++++++++--------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/src/pages/panel/inventory/DataGridPagination.tsx b/src/pages/panel/inventory/DataGridPagination.tsx index 4050b976..bd539205 100644 --- a/src/pages/panel/inventory/DataGridPagination.tsx +++ b/src/pages/panel/inventory/DataGridPagination.tsx @@ -18,51 +18,53 @@ export const DataGridPagination = () => { const total = useGridSelector(apiRef, gridRowCountSelector) return ( - - + + {page * size}-{(page + 1) * size > total ? total : (page + 1) * size}{' '} of {total} results - { - return ['start-ellipsis', 'end-ellipsis', 'page'].includes(props2.type) ? ( - - ) : ['next', 'previous'].includes(props2.type) ? ( - - ) : null - }} - onChange={(_: unknown, value: number) => apiRef.current.setPage(value - 1)} - /> + {pageCount < 2 ? null : ( + { + return ['start-ellipsis', 'end-ellipsis', 'page'].includes(props2.type) ? ( + + ) : ['next', 'previous'].includes(props2.type) ? ( + + ) : null + }} + onChange={(_: unknown, value: number) => apiRef.current.setPage(value - 1)} + /> + )} ) }