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

Alphanumeric sort unresponsive on 3rd or 4th click #820

Open
risafletcher opened this issue Jan 9, 2018 · 3 comments
Open

Alphanumeric sort unresponsive on 3rd or 4th click #820

risafletcher opened this issue Jan 9, 2018 · 3 comments

Comments

@risafletcher
Copy link

risafletcher commented Jan 9, 2018

Angular version 1.4.10
Smart-Table version 2.1.8

CASE: Using st-sort to sort items (alphabetically) by a string property.
EXPECTED: First click: sort A -Z, Second click: Z - A, Third click: sort A - Z, Fourth click: Z - A, and so on and so forth.
RESULT: First click: sort A - Z, Second click: Z - A, Third click: unresponsive (still Z - A), Fourth click: A - Z.
Sometimes it stops on third, sometimes on forth. The caret icon disappears and requires another click to sort again. Is this an issue with Angular's orderBy?

A good example is the smart table docs under the 'Sort Data' section. You'll find that the table's 'first name' header has the same behavior. I'm not using a getter in my situation but the issue is the same.

@MrWook
Copy link
Contributor

MrWook commented Jan 9, 2018

Hello @risafletcher,

this is the correct behaviour. The stSort has three states.

  1. Ascending (A-Z)
  2. Descending (Z-A)
  3. Natural (without sorting)

Probably your raw data is sorted in descending order. If you don't want to have the natural order:

You can skip the "natural order" state by adding st-skip-natural="true" as attribute of your th element.

@risafletcher
Copy link
Author

@MrWook Forgot to mention that in my post. Yes, st-skip-natural is set to true. Issue persists.

@MrWook
Copy link
Contributor

MrWook commented Jan 31, 2018

Hello @risafletcher,

my next thought would be the outdated angular version but i can't help you without an example plunk.

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

2 participants