Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Ordering string which are case sensitive #13238

Closed
nihn opened this issue Nov 3, 2015 · 1 comment
Closed

Ordering string which are case sensitive #13238

nihn opened this issue Nov 3, 2015 · 1 comment

Comments

@nihn
Copy link

nihn commented Nov 3, 2015

Hi,

when I want to sort some strings with respected lower and upper case I'm forced to use my own function. Is there any way to use orderBy in this case?

https://github.com/angular/angular.js/blob/v1.5.0-beta.1/src/ng/filter/orderBy.js#L275

@Narretz
Copy link
Contributor

Narretz commented Nov 6, 2015

No, there's currently no way to do this. Here's a PR which was met with some reservations: #8112.

gkalpak added a commit to gkalpak/angular.js that referenced this issue Apr 19, 2016
With this change the 3rd argument is interpreted as a comparator function, used to compare the
values returned by the predicates. Leaving it empty falls back to the default comparator and a
value of `false` is a special case that also falls back to the default comparator but reverses the
order. Thus the new implementation is backwards compatible.

Helps with angular#12572 (maybe this is as close as we want to get).

Fixes angular#13238
Fixes angular#14455

Closes angular#5123
Closes angular#8112
Closes angular#10368
gkalpak added a commit to gkalpak/angular.js that referenced this issue Apr 21, 2016
With this change the 3rd argument is interpreted as a comparator function, used to compare the
values returned by the predicates. Leaving it empty falls back to the default comparator and a
value of `false` is a special case that also falls back to the default comparator but reverses the
order. Thus the new implementation is backwards compatible.

This commit also xpands the documentation to cover the algorithm used to sort elements and adds
a few more unit and e2e tests (unrelated to the change).

Helps with angular#12572 (maybe this is as close as we want to get).

Fixes angular#13238
Fixes angular#14455

Closes angular#5123
Closes angular#8112
Closes angular#10368
gkalpak added a commit to gkalpak/angular.js that referenced this issue Apr 21, 2016
With this change the 3rd argument is interpreted as a comparator function, used to compare the
values returned by the predicates. Leaving it empty falls back to the default comparator and a
value of `false` is a special case that also falls back to the default comparator but reverses the
order. Thus the new implementation is backwards compatible.

This commit also expands the documentation to cover the algorithm used to sort elements and adds
a few more unit and e2e tests (unrelated to the change).

Helps with angular#12572 (maybe this is as close as we want to get).

Fixes angular#13238
Fixes angular#14455

Closes angular#5123
Closes angular#8112
Closes angular#10368
@gkalpak gkalpak closed this as completed in 48c8b23 Jun 6, 2016
gkalpak added a commit that referenced this issue Jun 6, 2016
Add an optional, 4th argument (`comparator`) for specifying a custom comparator function, used to
compare the values returned by the predicates. Omitting the argument, falls back to the default,
built-in comparator. The 3rd argument (`reverse`) can still be used for controlling the sorting
order (i.e. ascending/descending).

Additionally, the documentation has been expanded to cover the algorithm used by the built-in
comparator and a few more unit and e2e tests (unrelated to the change) have been added.

Helps with #12572 (maybe this is as close as we want to get).

Fixes #13238
Fixes #14455

Closes #5123
Closes #8112
Closes #10368

Closes #14468
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants