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]: SorterResults are not sorted using multiplePriority #28978

Open
1 task done
Backfighter opened this issue Jan 21, 2021 · 0 comments
Open
1 task done

[Table]: SorterResults are not sorted using multiplePriority #28978

Backfighter opened this issue Jan 21, 2021 · 0 comments
Labels

Comments

@Backfighter
Copy link

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Click on Text to sort ascending after that click on Number to sort ascending.

What is expected?

Since Number has a higher multiplePriority than Text the order of the SorterResults should be: Number, Text

What is actually happening?

The SorterResults is based on the order of clicking the columns not on the multiplePriority.

Environment Info
antd 4.10.3
React react/react-dom
System Linux
Browser Chrome

It is clear from the current implementaion:

export function getSortData<RecordType>(
data: RecordType[],
sortStates: SortState<RecordType>[],
childrenColumnName: string,
): RecordType[] {
const innerSorterStates = sortStates
.slice()
.sort((a, b) => (b.multiplePriority as number) - (a.multiplePriority as number));

that the multiplePriority is only considered when sorting entries client-side. If one however wants to use sorting on the server-side one has no way to access the multiplePriority and therefore has to implement sort priority manually.

Some users might already rely on the current behaviour. I therefore would recommend to make sorting by multiplePriority as well as multipleMode a feature that can be turned on or off and use different defaults for client- and server-side sorting.

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

No branches or pull requests

1 participant