mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:25:57 +00:00
fix: default sort with multi filter target keys (#5404)
This commit is contained in:
parent
22ab8f1e78
commit
5d11c3cb74
@ -138,10 +138,10 @@ export class OptionsParser {
|
||||
sort = sort.split(',');
|
||||
}
|
||||
|
||||
let defaultSortField = this.model.primaryKeyAttribute;
|
||||
let defaultSortField: Array<string> | string = this.model.primaryKeyAttribute;
|
||||
|
||||
if (Array.isArray(this.collection.filterTargetKey) && this.collection.filterTargetKey.length == 1) {
|
||||
defaultSortField = this.collection.filterTargetKey[0];
|
||||
if (Array.isArray(this.collection.filterTargetKey)) {
|
||||
defaultSortField = this.collection.filterTargetKey;
|
||||
}
|
||||
|
||||
if (!defaultSortField && this.collection.filterTargetKey && !Array.isArray(this.collection.filterTargetKey)) {
|
||||
@ -149,8 +149,11 @@ export class OptionsParser {
|
||||
}
|
||||
|
||||
if (defaultSortField && !this.options?.group) {
|
||||
if (!sort.includes(defaultSortField)) {
|
||||
sort.push(defaultSortField);
|
||||
defaultSortField = lodash.castArray(defaultSortField);
|
||||
for (const key of defaultSortField) {
|
||||
if (!sort.includes(key)) {
|
||||
sort.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user