Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita68c306

Browse files
fixed sorting issue in table's data/datetime columns
1 parent10fbb2f commita68c306

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export class ColumnComp extends ColumnInitComp {
219219
constcolumnType=this.children.render.getSelectedComp().getComp().children.compType.getView();
220220
return{
221221
...superView,
222+
columnType,
222223
editable:ColumnTypeCompMap[columnType].canBeEditable()&&superView.editable,
223224
};
224225
}

‎client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { TableColumnLinkStyleType, TableColumnStyleType } from "comps/controls/s
2121
importTooltipfrom"antd/es/tooltip";
2222
importInfoCircleOutlinedfrom"@ant-design/icons/InfoCircleOutlined";
2323
import{EMPTY_ROW_KEY}from"./tableCompView";
24+
importdayjsfrom"dayjs";
2425

2526
exportconstCOLUMN_CHILDREN_KEY="children";
2627
exportconstOB_ROW_ORI_INDEX="__ob_origin_index";
@@ -399,7 +400,14 @@ export function columnsToAntdFormat(
399400
},
400401
...(column.sortable
401402
?{
402-
sorter:{multiple:(sortedColumns.length-mIndex)+1},
403+
sorter:{
404+
multiple:(sortedColumns.length-mIndex)+1,
405+
compare:column.columnType==='date'||column.columnType==='dateTime'
406+
?(a,b)=>{
407+
returndayjs(a[column.dataIndex]asstring).unix()-dayjs(b[column.dataIndex]asstring).unix();
408+
}
409+
:undefined
410+
},
403411
sortOrder:sortMap.get(column.dataIndex),
404412
showSorterTooltip:false,
405413
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp