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) {
|
||||
const parentSort = fieldSchema.parent?.['x-decorator-props']?.['params']?.sort;
|
||||
const sortParams = ctx.params.sort || [];
|
||||
// NOTE: 这里将原本就有的排序参数保留
|
||||
const parentSortReal = [...new Set([...sortParams, ...(parentSort || [])])];
|
||||
|
||||
const sort = globalSort
|
||||
? globalSort
|
||||
: sorter.order
|
||||
? sorter.order === `ascend`
|
||||
? [sorter.field]
|
||||
: [`-${sorter.field}`]
|
||||
: parentSort;
|
||||
// NOTE: 这里将原本就有的排序参数保留
|
||||
const sortParams = ctx.params.sort || [];
|
||||
const sortFinal = [...new Set([...sortParams, ...(sort || [])])];
|
||||
ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort: sortFinal });
|
||||
: parentSortReal;
|
||||
|
||||
ctx.service.run({ ...ctx.service.params?.[0], page: current, pageSize, sort });
|
||||
},
|
||||
onClickRow(record, setSelectedRow, selectedRow) {
|
||||
const { targets, uid } = findFilterTargets(fieldSchema);
|
||||
|
Loading…
Reference in New Issue
Block a user