KevinVandy / material-react-table

A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript
https://material-react-table.com
MIT License
1.46k stars 418 forks source link

Default sort function is case-sensitive #193

Closed neilbags closed 1 year ago

neilbags commented 1 year ago

material-react-table version

v1.3.4

react & react-dom versions

v18.2.0

Describe the bug and the steps to reproduce it

The documentation says: "By default, Material React Table will use an alphanumeric sorting function for all columns."

But it appears to be using one of the case-sensitive algorithms. I've forked the Basic Example to illustrate this. All I have changed is 'Joe' to 'joe' and set the initial state to sort by name.firstName: https://codesandbox.io/s/jovial-bush-th8o4h?file=/src/TS.tsx

Ref: https://www.material-react-table.com/docs/guides/sorting#sorting-functions

Minimal, Reproducible Example - (Optional, but Recommended)

https://codesandbox.io/s/jovial-bush-th8o4h?file=/src/TS.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No response

Terms

KevinVandy commented 1 year ago

I'm pretty sure this is intentional by TanStack Table. If you need a different sorting behavior, you can specify a different sortingFn per column, or in the defaultColumn prop. See the built-in sortingFn options here

neilbags commented 1 year ago

Thanks, yes I am aware of how to change the sorting function. I raised the issue because the documentation didn't appear to match the behaviour. If the behaviour is intentional do you want a PR to update the docs?

KevinVandy commented 1 year ago

Thanks, yes I am aware of how to change the sorting function. I raised the issue because the documentation didn't appear to match the behaviour. If the behaviour is intentional do you want a PR to update the docs?

Sure. I didn't think that saying alphanumeric implied case sensitivity or not. What should it say?

neilbags commented 1 year ago

In the docs, because the word 'alphanumeric' is in a code tag, I think the reader would assume you are referring to the alphanumeric sorting function from Tanstack, rather than just making a general statement about alphanumeric sorting.

I think the docs should either say:

I'm not sure which is correct because I haven't dug into the code to see whats actually happening