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

Comments

Projects
None yet
6 participants
@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

This comment has been minimized.

Collaborator

ilanus commented Oct 19, 2018

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

@afc163

This comment has been minimized.

Member

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

Fix sort order broken issue when columns were put in render
will handle these situation

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

close #12870
close #12737
@gijo-varghese

This comment has been minimized.

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

This comment has been minimized.

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