sortingFn: 'alphanumeric' returns numbers last
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 3.6k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 10
Description
TanStack Table version
8.14.0
Framework/Library version
React 18.2
Describe the bug and the steps to reproduce it
expected behavior is for sorting to put symbols, numbers, followed by letters.
what i see is letters first with numbers last
example.
Amy
Frank
1dude
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
propriatary code sorry
Screenshots or Videos (Optional)
column def
{
id: stationCode,
accessorFn: (row) => ${row.x}::${row.y}
sortingFn: 'alphanumeric',
}
default sorting def
defaultSorting={[{ id: 'stationCode', desc: false }]}
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging
how i solved : sortingFn: (rowA, rowB, columnId) => {
console.log('rowA', rowA.getValue('stationCode'))
return rowA
.getValue('stationCode')
.localeCompare(rowB.getValue('stationCode'), 'en', { numeric: true })
},
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides no repository files or tests to start from. Reproduce the alphanumeric sortingFn behavior with the shown accessorFn and defaultSorting configuration, then inspect the sorting entry point; done when symbols, numbers, and letters sort in the expected order, ideally with a minimal debuggable example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100