fix: table column sort params should support cancel sort (#3372)

* fix: sort params

* fix: sort params
This commit is contained in:
katherinehhh 2024-01-12 09:50:17 +08:00 committed by GitHub
parent 57a2bac72a
commit dfb4421484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,11 +174,7 @@ export const useTableBlockProps = () => {
ctx.service.refresh(); ctx.service.refresh();
}, },
onChange({ current, pageSize }, filters, sorter) { onChange({ current, pageSize }, filters, sorter) {
const sort = sorter.order const sort = sorter.order ? (sorter.order === `ascend` ? [sorter.field] : [`-${sorter.field}`]) : globalSort;
? sorter.order === `ascend`
? [sorter.field]
: [`-${sorter.field}`]
: globalSort || ctx.service.params?.[0]?.sort;
ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort }); ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort });
}, },
onClickRow(record, setSelectedRow, selectedRow) { onClickRow(record, setSelectedRow, selectedRow) {