From 004a9dc080c2793e68fb0a88a50ec64224976325 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 29 Oct 2020 16:51:50 -0400 Subject: [PATCH 1/2] Clarify acceptable return values for `sortType` --- docs/src/pages/docs/api/useSortBy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/pages/docs/api/useSortBy.md b/docs/src/pages/docs/api/useSortBy.md index 5218fcb769..072e3bbb7f 100644 --- a/docs/src/pages/docs/api/useSortBy.md +++ b/docs/src/pages/docs/api/useSortBy.md @@ -74,7 +74,7 @@ The following options are supported on any `Column` object passed to the `column - This may be useful in situations where positive and negative connotation is inverted, eg. a Golfing score where a lower score is considered more positive than a higher one. - `sortType: String | Function(rowA: , rowB: , columnId: String, desc: Bool)` - Used to compare 2 rows of data and order them correctly. - - If a **function** is passed, it must be **memoized**. The sortType function should return -1 if rowA is larger, and 1 if rowB is larger. `react-table` will take care of the rest. + - If a **function** is passed, it must be **memoized**. The sortType function should return a negative value if rowA is larger, and a positive value if rowB is larger. `react-table` will take care of the rest. - String options: `basic`, `datetime`, `alphanumeric`. Defaults to `alphanumeric`. - The resolved function from the this string/function will be used to sort the this column's data. - If a `string` is passed, the function with that name located on either the custom `sortTypes` option or the built-in sorting types object will be used. From 474b27210764fbee8b4d9e5a81b98519ce494582 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 29 Oct 2020 16:56:40 -0400 Subject: [PATCH 2/2] Update useSortBy.md --- docs/src/pages/docs/api/useSortBy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/pages/docs/api/useSortBy.md b/docs/src/pages/docs/api/useSortBy.md index 072e3bbb7f..1398d2d409 100644 --- a/docs/src/pages/docs/api/useSortBy.md +++ b/docs/src/pages/docs/api/useSortBy.md @@ -74,7 +74,7 @@ The following options are supported on any `Column` object passed to the `column - This may be useful in situations where positive and negative connotation is inverted, eg. a Golfing score where a lower score is considered more positive than a higher one. - `sortType: String | Function(rowA: , rowB: , columnId: String, desc: Bool)` - Used to compare 2 rows of data and order them correctly. - - If a **function** is passed, it must be **memoized**. The sortType function should return a negative value if rowA is larger, and a positive value if rowB is larger. `react-table` will take care of the rest. + - If a **function** is passed, it must be **memoized**. The sortType function should return a negative value if rowA is larger, a positive value if rowB is larger, or zero if the rows are equal. `react-table` will take care of the rest. - String options: `basic`, `datetime`, `alphanumeric`. Defaults to `alphanumeric`. - The resolved function from the this string/function will be used to sort the this column's data. - If a `string` is passed, the function with that name located on either the custom `sortTypes` option or the built-in sorting types object will be used.