Smart-Table icon indicating copy to clipboard operation
Smart-Table copied to clipboard

Alphanumeric sort unresponsive on 3rd or 4th click

Open risafletcher opened this issue 7 years ago • 3 comments

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.

risafletcher avatar Jan 09 '18 00:01 risafletcher

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.

MrWook avatar Jan 09 '18 08:01 MrWook

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

risafletcher avatar Jan 23 '18 23:01 risafletcher

Hello @risafletcher,

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

MrWook avatar Jan 31 '18 17:01 MrWook