Possible to add SortDirection as an optional parameter to SortingFn? #5453
Unanswered
rupayan-ninety-eight
asked this question in
Ideas
Replies: 1 comment
-
How I approach this problem in my project is by setting a SortingState
and then passing it into my tables initial state
along with the other options |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Something like this:
export type SortingFn<TData extends AnyData> = { (rowA: Row<TData>, rowB: Row<TData>, columnId: string, sortDirection: SortDirection): number }
A table component I'm working on needed
null
values to be placed last in the list regardless of sorting order. I tried usingsortUndefined
but it doesn't seem to work with custom sorting functions.I had to then try a workaround, where I used the sorting state from
const [sorting, setSorting] = useState([])
to figure out the sort order within my custom sorting function.If I'm missing an easier way to do this, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions