mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
[Table] Show total pages if client-side paginaiton
This commit is contained in:
parent
1fdbac3f2d
commit
4f48b6b580
2 changed files with 16 additions and 6 deletions
|
|
@ -5,7 +5,8 @@ export const Pagination = function Pagination({
|
|||
serverSide,
|
||||
autoGotoPage,
|
||||
autoCanNextPage,
|
||||
autoPageCount
|
||||
autoPageCount,
|
||||
autoPageOptions
|
||||
}) {
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const [pageCount, setPageCount] = useState(autoPageCount);
|
||||
|
|
@ -45,14 +46,22 @@ export const Pagination = function Pagination({
|
|||
{'<'}
|
||||
</button>{' '}
|
||||
<small className="p-1 mx-2">
|
||||
<strong>
|
||||
{pageIndex}
|
||||
</strong>
|
||||
|
||||
{serverSide &&
|
||||
<strong>
|
||||
{pageIndex}
|
||||
</strong>
|
||||
}
|
||||
{!serverSide &&
|
||||
<strong>
|
||||
{pageIndex} of {autoPageOptions.length}
|
||||
</strong>
|
||||
}
|
||||
</small>
|
||||
<button
|
||||
className="btn btn-light btn-sm"
|
||||
onClick={() => goToNextPage()}
|
||||
disabled={!autoCanNextPage}
|
||||
disabled={!autoCanNextPage && !serverSide}
|
||||
>
|
||||
{'>'}
|
||||
</button>{' '}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ export function Table({
|
|||
columns,
|
||||
data,
|
||||
defaultColumn,
|
||||
initialState: { pageIndex: 0 },
|
||||
initialState: { pageIndex: 0, pageSize: serverSidePagination ? -1 : 10}, // pageSize should be unset if server-side pagination is enabled
|
||||
pageCount: -1,
|
||||
manualPagination: false,
|
||||
getExportFileBlob
|
||||
|
|
@ -515,6 +515,7 @@ export function Table({
|
|||
autoGotoPage={gotoPage}
|
||||
autoCanNextPage={canNextPage}
|
||||
autoPageCount={pageCount}
|
||||
autoPageOptions={pageOptions}
|
||||
onPageIndexChanged={onPageIndexChanged}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue