T
TanStack2y ago
conscious-sapphire

Custom sorting examples

Hi, I'm in the process of converting a set of tables over to Tanstack. Has mostly been going well but I seem to have run up against an issue and I was wondering if there were any examples of how to get a custom sort function working (this may be my relative Typescript newbness biting me). I have tried adding it to the table's sortingFns as described in https://tanstack.com/table/v8/docs/guide/sorting#custom-sorting-functions, but when I add that fn name as a string in my column definition's sortingFn it does not recognize it (sortingFn: 'myCustomSortThatIWantToUseInManyPlaces') . So I've tried to create it as a stand-alone function that I can just reference (sortingFn: myCustomSortThatIWantToUseInManyPlaces), but I can't seem to get it typed correctly. Are there any examples of this that I can refer to for guidance? TIA!
Sorting Guide | TanStack Table Docs
Examples Want to skip to the implementation? Check out these examples:
1 Reply
deep-jade
deep-jade2y ago
If you create a sandbox with your code that would certainly help with identifying the issue.

Did you find this page helpful?