`undefined` cannot be removed from `sortDirections`
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
Set sortDirections
to any set that does not include undefined
. Sorting will still cycle between the defined directions and undefined
.
What is expected?
If sortDirections
is ["ascend","descend"]
or ["ascend"]
then only the specified directions should be allowed.
What is actually happening?
Clicking the column header multiple times will change direction and will always include the undefined
sort order.
Environment | Info |
---|---|
antd | 3.15.0 |
React | 16.8.4 |
System | Mac? |
Browser | Chrome |
My table loads remote data which will always be sorted by one column. If a user sorts by a column, they must change direction or sort by another column. It does not make sense here to specify a column with an order of undefined
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Issuehunt
`undefined` cannot be removed from `sortDirections` #15415 ... Sorting will still cycle between the defined directions and undefined .
Read more >The constructor Sort(Sort.Direction, String) is undefined
Direction.DESC, "createdAt"))); }. But I get error: The constructor Sort(Sort.Direction, String) is undefined. This is the latest code: ...
Read more >sort - Sorting multiple times in Aura lighting table gives me error
Sorting multiple times in Aura lighting table gives me error - Uncaught (in promise) TypeError: Cannot set property 'rowIndex' of undefined.
Read more >Sorting | TanStack Table Docs
Enables/Disables the ability to remove sorting for the table. If true then changing sort order will circle like: 'none' -> 'desc' -> 'asc'...
Read more >Table - Ant Design
Since this is just a syntax sugar for the prop columns , you can't ... sortDirections: ['ascend' | 'descend'] defines available sort methods...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well that way you are forcing users to write custom sortOrders. I agree with @roblingle where by default we should be able to specify what states to allow for sorting. [ascend, descend, default] or only [ascend, descend]. Also the documentation is confusing because looking at the description for sortDirections it kind of leads a user to think that you can specify the type of sorts allowed
It’s not a bug. Column should aways enable user to set sort state back after
sortDirections
end. If you want to lock the sortOrder without default. You can use controlledsortOrder
instead: https://codesandbox.io/s/jz071jrm7y