Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table sorter gets stuck when render function is present on column #12737

Closed
kevinfling opened this issue Oct 19, 2018 · 4 comments
Closed

Table sorter gets stuck when render function is present on column #12737

kevinfling opened this issue Oct 19, 2018 · 4 comments
Assignees

Comments

@kevinfling
Copy link

@kevinfling kevinfling commented Oct 19, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.10.1

Environment

MacOS / Google Chrome Version 69.0.3497.100 (Official Build) (64-bit)

Reproduction link

https://codepen.io/anon/pen/YJvXrw

Steps to reproduce

const columns = [{
  title: 'Name',
  dataIndex: 'name',
  sorter: true, // This sorter gets stuck
  key: 'name',
  render: name => (<strong>{name}</strong>)
}, {
  title: 'Age',
  dataIndex: 'age',
  sorter: true, // This sorter works correctly
  key: 'age',
}];

Edit: This only seems to happen to the sort state when columns are inside render, so I believe it's related to #12571.

What is expected?

Sort should toggle from ascend/descend/none.

What is actually happening?

Sorter gets stuck on descending sort.

@ilanus
Copy link
Contributor

@ilanus ilanus commented Oct 19, 2018

@afc163 afc163 added 🐛 Bug and removed 🐛 Bug labels Oct 20, 2018
@afc163
Copy link
Member

@afc163 afc163 commented Oct 20, 2018

Just move columns outside render: https://codepen.io/anon/pen/JmZRXp?editors=0010

@afc163 afc163 closed this Oct 20, 2018
afc163 added a commit that referenced this issue Nov 1, 2018
will handle these situation

- with 'key'
- with function has same stringify value

close #12870
close #12737
@gijo-varghese
Copy link

@gijo-varghese gijo-varghese commented Nov 2, 2018

@afc163 I'm facing the same issue. Moving it outside render function fixed the issue. But there are cases where props change and columns filers may change. Moving outside doesn't work in that situation

@adamdarr
Copy link

@adamdarr adamdarr commented Nov 8, 2018

@gijo-varghese In that case, you can use controlled mode to manually set the sortOrder

@afc163 afc163 mentioned this issue Jul 22, 2019
1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants