diff --git a/client/src/pages/vendors/list.tsx b/client/src/pages/vendors/list.tsx index 3ec1f1c..ff7d057 100644 --- a/client/src/pages/vendors/list.tsx +++ b/client/src/pages/vendors/list.tsx @@ -11,26 +11,48 @@ import { import { Table, Space } from "antd"; import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; +import { genericSorter } from "../../utils/sorting"; dayjs.extend(utc); export const VendorList: React.FC = () => { - const { tableProps } = useTable({ + const { tableProps, sorters } = useTable({ syncWithLocation: true, pagination: { mode: "client", pageSize: 20, }, + sorters: { + mode: "off", // Disable server-side sorting + initial: [ + { + field: "id", + order: "asc", + }, + ], + }, }); + // Copy dataSource to avoid mutating the original + const dataSource = [...(tableProps.dataSource || [])]; + + // Sort dataSource by the sorters + dataSource.sort(genericSorter(sorters)); + return ( - - - +
+ + ( = () => { /> )} /> - +