mirror of
https://github.com/gosticks/react-table.git
synced 2026-07-02 02:20:06 +00:00
Fix README: defaultSortMethod doesn't match code (#910)
Updating the `defaultSortMethod` in the README to match the [code](3a8a037ee6/src/defaultProps.js (L46))
This commit is contained in:
committed by
Tanner Linsley
parent
4aa07c33da
commit
72afabbd03
11
README.md
11
README.md
@@ -214,11 +214,11 @@ These are all of the available props (and their default values) for the main `<R
|
||||
},
|
||||
defaultSortMethod: (a, b, desc) => {
|
||||
// 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
|
||||
@@ -226,7 +226,8 @@ These are all of the available props (and their default values) for the main `<R
|
||||
if (a < b) {
|
||||
return -1
|
||||
}
|
||||
// returning 0, undefined or any falsey value will use subsequent sorts or the index as a tiebreaker
|
||||
// returning 0, undefined or any falsey value will use subsequent sorts or
|
||||
// the index as a tiebreaker
|
||||
return 0
|
||||
},
|
||||
PadRowComponent: () => <span> </span>, // the content rendered inside of a padding row
|
||||
|
||||
Reference in New Issue
Block a user