mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-16 23:10:17 +00:00
Fix default sort algorithm (#268)
This commit is contained in:
committed by
Tanner Linsley
parent
49c5a3d5e1
commit
95164311fa
+4
-4
@@ -32,11 +32,11 @@ export default {
|
||||
},
|
||||
defaultSortMethod: (a, b) => {
|
||||
// force null and undefined to the bottom
|
||||
a = (a === null || a === undefined) ? -Infinity : a
|
||||
b = (b === null || b === undefined) ? -Infinity : b
|
||||
a = (a === null || a === undefined) ? '' : a
|
||||
b = (b === null || b === undefined) ? '' : b
|
||||
// force any string values to lowercase
|
||||
a = a === 'string' ? a.toLowerCase() : a
|
||||
b = b === 'string' ? b.toLowerCase() : b
|
||||
a = typeof a === 'string' ? a.toLowerCase() : a
|
||||
b = typeof b === 'string' ? b.toLowerCase() : b
|
||||
// Return either 1 or -1 to indicate a sort priority
|
||||
if (a > b) {
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user