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
1 task done
kevinfling opened this issue Oct 19, 2018 · 4 comments
Closed
1 task done

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 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 commented Oct 19, 2018

@afc163 afc163 added 🐛 Bug Ant Design Team had proved that this is a bug. and removed 🐛 Bug Ant Design Team had proved that this is a bug. labels Oct 20, 2018
@afc163
Copy link
Member

afc163 commented Oct 20, 2018

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

@afc163 afc163 closed this as completed 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

@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 commented Nov 8, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants