fix: table,sort (#1361)
Reviewed-on: daoyoucloud/tachybase#1361 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
parent
a5c4b68c16
commit
60ff2b0788
@ -64,17 +64,19 @@ export const useTableBlockProps = () => {
|
|||||||
},
|
},
|
||||||
onChange({ current, pageSize }, filters, sorter) {
|
onChange({ current, pageSize }, filters, sorter) {
|
||||||
const parentSort = fieldSchema.parent?.['x-decorator-props']?.['params']?.sort;
|
const parentSort = fieldSchema.parent?.['x-decorator-props']?.['params']?.sort;
|
||||||
|
const sortParams = ctx.params.sort || [];
|
||||||
|
// NOTE: 这里将原本就有的排序参数保留
|
||||||
|
const parentSortReal = [...new Set([...sortParams, ...(parentSort || [])])];
|
||||||
|
|
||||||
const sort = globalSort
|
const sort = globalSort
|
||||||
? globalSort
|
? globalSort
|
||||||
: sorter.order
|
: sorter.order
|
||||||
? sorter.order === `ascend`
|
? sorter.order === `ascend`
|
||||||
? [sorter.field]
|
? [sorter.field]
|
||||||
: [`-${sorter.field}`]
|
: [`-${sorter.field}`]
|
||||||
: parentSort;
|
: parentSortReal;
|
||||||
// NOTE: 这里将原本就有的排序参数保留
|
|
||||||
const sortParams = ctx.params.sort || [];
|
ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort });
|
||||||
const sortFinal = [...new Set([...sortParams, ...(sort || [])])];
|
|
||||||
ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort: sortFinal });
|
|
||||||
},
|
},
|
||||||
onClickRow(record, setSelectedRow, selectedRow) {
|
onClickRow(record, setSelectedRow, selectedRow) {
|
||||||
const { targets, uid } = findFilterTargets(fieldSchema);
|
const { targets, uid } = findFilterTargets(fieldSchema);
|
||||||
|
Loading…
Reference in New Issue
Block a user