question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`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

Edit on CodeSandbox

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:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
StallionVcommented, Sep 17, 2019

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 controlled sortOrder instead: https://codesandbox.io/s/jz071jrm7y

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

4reactions
zombieJcommented, May 10, 2019

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 controlled sortOrder instead: https://codesandbox.io/s/jz071jrm7y

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found