Smart-Table
Smart-Table copied to clipboard
Alphanumeric sort unresponsive on 3rd or 4th click
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.
Hello @risafletcher,
this is the correct behaviour. The stSort has three states.
- Ascending (A-Z)
- Descending (Z-A)
- 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.
@MrWook Forgot to mention that in my post. Yes, st-skip-natural is set to true. Issue persists.
Hello @risafletcher,
my next thought would be the outdated angular version but i can't help you without an example plunk.