chore: custom table sort

This commit is contained in:
jialin
2024-07-16 18:13:34 +08:00
parent a27fa9d56c
commit b05595f84b
8 changed files with 127 additions and 18 deletions
+6 -6
View File
@@ -110,9 +110,9 @@ const Models: React.FC<ModelsProps> = ({
});
};
const handleTableChange = (pagination: any, filters: any, sorter: any) => {
console.log('handleTableChange=======', pagination, filters, sorter);
setSortOrder(sorter.order);
const handleOnSort = (dataIndex: string, order: any) => {
console.log('handleTableChange=======', dataIndex, order);
setSortOrder(order);
};
const handleAddModal = () => {
@@ -326,7 +326,7 @@ const Models: React.FC<ModelsProps> = ({
rowKey="id"
childParentKey="model_id"
expandable={true}
onChange={handleTableChange}
onSort={handleOnSort}
pollingChildren={false}
watchChildren={true}
loadChildren={getModelInstances}
@@ -384,8 +384,7 @@ const Models: React.FC<ModelsProps> = ({
key="created_at"
defaultSortOrder="descend"
sortOrder={sortOrder}
showSorterTooltip={false}
sorter={true}
sorter={false}
render={(text, row) => {
return dayjs(text).format('YYYY-MM-DD HH:mm:ss');
}}
@@ -394,6 +393,7 @@ const Models: React.FC<ModelsProps> = ({
span={4}
title={intl.formatMessage({ id: 'common.table.operation' })}
key="operation"
dataIndex="operation"
render={(text, record) => {
return !record.transition ? (
<DropdownButtons