Client: Perform pagination using AntD instead
If we let Refine do the pagination, it will only return a page's worth of items in the dataSource. This makes the sorting useless if the items span multiple pages. Now we let Ant Design to the pagination instead.
This commit is contained in:
12
client/src/pages/vendors/list.tsx
vendored
12
client/src/pages/vendors/list.tsx
vendored
@@ -17,10 +17,9 @@ dayjs.extend(utc);
|
||||
|
||||
export const VendorList: React.FC<IResourceComponentsProps> = () => {
|
||||
const { tableProps, sorters } = useTable({
|
||||
syncWithLocation: true,
|
||||
syncWithLocation: false,
|
||||
pagination: {
|
||||
mode: "client",
|
||||
pageSize: 20,
|
||||
mode: "off", // Perform pagination in antd's Table instead. Otherwise client-side sorting/filtering doesn't work.
|
||||
},
|
||||
sorters: {
|
||||
mode: "off", // Disable server-side sorting
|
||||
@@ -41,13 +40,18 @@ export const VendorList: React.FC<IResourceComponentsProps> = () => {
|
||||
|
||||
return (
|
||||
<List>
|
||||
<Table {...tableProps} dataSource={dataSource} rowKey="id">
|
||||
<Table.Column
|
||||
dataIndex="id"
|
||||
title="Id"
|
||||
sorter={true}
|
||||
defaultSortOrder="ascend"
|
||||
/>
|
||||
<Table
|
||||
{...tableProps}
|
||||
dataSource={dataSource}
|
||||
pagination={{ showSizeChanger: true, pageSize: 20 }}
|
||||
rowKey="id"
|
||||
>
|
||||
<Table.Column dataIndex="name" title="Name" sorter={true} />
|
||||
<Table.Column
|
||||
dataIndex={["registered"]}
|
||||
|
||||
Reference in New Issue
Block a user