fix: inconsistance page size of paginated data tables

This commit is contained in:
Ahmed Bouhuolia
2024-08-14 15:23:14 +02:00
parent 64c4d7b5a4
commit 5c1fa8f5cd
9 changed files with 29 additions and 1 deletions

View File

@@ -60,7 +60,7 @@ export function DataTable(props) {
// Pagination props.
initialPageIndex = 0,
initialPageSize = 10,
initialPageSize = 20,
updateDebounceTime = 200,
selectionColumnWidth = 42,

View File

@@ -136,6 +136,7 @@ function CustomersTable({
sticky={true}
spinnerProps={{ size: 30 }}
pagination={true}
initialPageSize={customersTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}

View File

@@ -20,6 +20,7 @@ import withExpensesActions from './withExpensesActions';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
import withExpenses from './withExpenses';
import { ActionsMenu, useExpensesTableColumns } from './components';
import { DRAWERS } from '@/constants/drawers';
@@ -39,6 +40,9 @@ function ExpensesDataTable({
// #withSettings
expensesTableSize,
// #withExpenses
expensesTableState
}) {
// Expenses list context.
const {
@@ -116,6 +120,7 @@ function ExpensesDataTable({
sticky={true}
onFetchData={handleFetchData}
pagination={true}
initialPageSize={expensesTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}
@@ -147,4 +152,5 @@ export default compose(
withSettings(({ expenseSettings }) => ({
expensesTableSize: expenseSettings?.tableSize,
})),
withExpenses(({ expensesTableState }) => ({ expensesTableState }))
)(ExpensesDataTable);

View File

@@ -17,6 +17,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
import withItems from './withItems';
import { useItemsListContext } from './ItemsListProvider';
import { useItemsTableColumns, ItemsActionMenuList } from './components';
@@ -43,6 +44,9 @@ function ItemsDataTable({
// #withSettings
itemsTableSize,
// #withItems
itemsTableState,
// #ownProps
tableProps,
}) {
@@ -137,6 +141,7 @@ function ItemsDataTable({
sticky={true}
rowClassNames={rowClassNames}
pagination={true}
initialPageSize={itemsTableState.pageSize}
manualSortBy={true}
manualPagination={true}
pagesCount={pagination.pagesCount}
@@ -174,4 +179,5 @@ export default compose(
withSettings(({ itemsSettings }) => ({
itemsTableSize: itemsSettings.tableSize,
})),
withItems(({ itemsTableState }) => ({ itemsTableState }))
)(ItemsDataTable);

View File

@@ -19,6 +19,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import withCreditNotes from './withCreditNotes';
import { useCreditNoteTableColumns, ActionsMenu } from './components';
import { useCreditNoteListContext } from './CreditNotesListProvider';
@@ -44,6 +45,9 @@ function CreditNotesDataTable({
// #withSettings
creditNoteTableSize,
// #withCreditNotes
creditNoteTableState
}) {
const history = useHistory();
@@ -129,6 +133,7 @@ function CreditNotesDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={creditNoteTableState.pageSize}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
@@ -159,4 +164,5 @@ export default compose(
withSettings(({ creditNoteSettings }) => ({
creditNoteTableSize: creditNoteSettings?.tableSize,
})),
withCreditNotes(({ creditNoteTableState }) => ({ creditNoteTableState }))
)(CreditNotesDataTable);

View File

@@ -9,6 +9,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import withEstimates from './withEstimates';
import { TABLES } from '@/constants/tables';
import {
@@ -42,6 +43,9 @@ function EstimatesDataTable({
// #withSettings
estimatesTableSize,
// #withEstimates
estimatesTableState
}) {
const history = useHistory();
@@ -141,6 +145,7 @@ function EstimatesDataTable({
selectionColumn={true}
sticky={true}
pagination={true}
initialPageSize={estimatesTableState.pageSize}
manualPagination={true}
pagesCount={pagination.pagesCount}
TableLoadingRenderer={TableSkeletonRows}
@@ -174,4 +179,5 @@ export default compose(
withSettings(({ estimatesSettings }) => ({
estimatesTableSize: estimatesSettings?.tableSize,
})),
withEstimates(({ estimatesTableState }) => ({ estimatesTableState }))
)(EstimatesDataTable);

View File

@@ -144,6 +144,7 @@ function InvoicesDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={invoicesTableState.pageSize}
manualPagination={true}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}

View File

@@ -130,6 +130,7 @@ function ReceiptsDataTable({
noInitialFetch={true}
sticky={true}
pagination={true}
initialPageSize={receiptTableState.pageSize}
pagesCount={pagination.pagesCount}
manualPagination={true}
autoResetSortBy={false}

View File

@@ -137,6 +137,7 @@ function VendorsTable({
expandable={false}
sticky={true}
pagination={true}
initialPageSize={vendorsTableState.pageSize}
manualSortBy={true}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}