This commit is contained in:
Tuğçe Küçükoğlu 2023-08-18 15:52:27 +03:00
parent 506fb3ee29
commit 0a97b8fe7e
6 changed files with 16 additions and 7 deletions

View file

@ -523,6 +523,7 @@ export default {
}
data.sort((data1, data2) => {
const comparer = new Intl.Collator(undefined, { numeric: true }).compare;
let value1 = resolvedFieldDatas.get(data1);
let value2 = resolvedFieldDatas.get(data2);
@ -531,7 +532,7 @@ export default {
if (value1 == null && value2 != null) result = -1;
else if (value1 != null && value2 == null) result = 1;
else if (value1 == null && value2 == null) result = 0;
else if (typeof value1 === 'string' && typeof value2 === 'string') result = new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
else if (typeof value1 === 'string' && typeof value2 === 'string') result = comparer(value1, value2);
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
return this.d_sortOrder * result;
@ -567,7 +568,9 @@ export default {
if (typeof value1 === 'string' || value1 instanceof String) {
if (value1.localeCompare && value1 !== value2) {
return this.d_multiSortMeta[index].order * new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
const comparer = new Intl.Collator(undefined, { numeric: true }).compare;
return this.d_multiSortMeta[index].order * comparer(value1, value2);
}
} else {
result = value1 < value2 ? -1 : 1;