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

When using a custom sort function, pass any other extra data. #368

Merged

Conversation

dana2208
Copy link
Contributor

The example shows how a column that displays enum values can be sorted according to those values and not the enum number.
const qualityType = {
0: 'good',
1: 'bad',
2: 'unknown'
};
Indeed, instead of sorting item tables according to the enum keys 0, 1 and 2 it is possible to sort now by the enum values "good", "bad" and "unknown" alphabetically which makes more sense since this is what the user can see.
ASC order will show "bad" items, then "good" items then "unknown" items (alphabetical order is respected), instead of showing "good", then "bad", then "unknown".

The example shows how a column that displays enum values can be sorted according to those values and not the enum number.
const qualityType = {
  0: 'good',
  1: 'bad',
  2: 'unknown'
};
Indeed, instead of sorting item tables according to the enum keys 0, 1 and 2 it is possible to sort now by the enum values "good", "bad" and "unknown" alphabetically which makes more sense since this is what the user can see.
ASC order will show "bad" items, then "good" items then "unknown" items (alphabetical order is respected), instead of showing "good", then "bad", then "unknown".
@AllenFang AllenFang merged commit 509ce22 into AllenFang:master Mar 28, 2016
@AllenFang
Copy link
Owner

Thanks @dana2208 :) It's a good example, I'll add it to the docs in website also.

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

Successfully merging this pull request may close these issues.

2 participants