mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 01:12:37 +00:00
Pull sort/compare utils from PrimeReact
This commit is contained in:
parent
c6cd944735
commit
4d6a272795
9 changed files with 55 additions and 32 deletions
|
@ -429,7 +429,7 @@ export default {
|
|||
},
|
||||
sortNodesSingle(nodes) {
|
||||
let _nodes = [...nodes];
|
||||
const comparer = new Intl.Collator(undefined, { numeric: true }).compare;
|
||||
const comparer = ObjectUtils.localeComparator();
|
||||
|
||||
_nodes.sort((node1, node2) => {
|
||||
const value1 = ObjectUtils.resolveFieldData(node1.data, this.d_sortField);
|
||||
|
@ -472,7 +472,7 @@ export default {
|
|||
return this.d_multiSortMeta.length - 1 > index ? this.multisortField(node1, node2, index + 1) : 0;
|
||||
} else {
|
||||
if ((typeof value1 === 'string' || value1 instanceof String) && (typeof value2 === 'string' || value2 instanceof String))
|
||||
return this.d_multiSortMeta[index].order * new Intl.Collator(undefined, { numeric: true }).compare(value1, value2);
|
||||
return this.d_multiSortMeta[index].order * ObjectUtils.localeComparator().compare(value1, value2);
|
||||
else result = value1 < value2 ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue