list.js icon indicating copy to clipboard operation
list.js copied to clipboard

data-default-order not working?

Open DannyJoris opened this issue 4 years ago • 2 comments

I'm either not understanding how data-default-order is supposed to work, or it's not working at all.

The docs: https://listjs.com/docs/search-sort/

Here's an example: https://codepen.io/DannyJoris/pen/PobqXjQ

<th class="sort" data-sort="name" data-default-order="asc">Name</th>
<th class="sort" data-sort="age" data-default-order="desc">Age</th>
<th class="sort" data-sort="city" data-default-order="asc">City</th>

When I click "Age" for the first time, I would expect the list to sort in descending (large to small) order, but this is ignored and just sorts in ascending order. The following toggles all work, but it's the initial sort that doesn't match with what I'm expecting.

Screen Shot 2021-02-02 at 4 17 46 PM

DannyJoris avatar Feb 02 '21 20:02 DannyJoris

Looks like only the doc change, but not the implementation has been merged to master. See #301.

markus-ksg avatar Mar 30 '21 11:03 markus-ksg

I believe I have updated it for the latest version 2.3 to work: https://github.com/iamrobert/list.js/blob/patch-1/src/sort.js

iamrobert avatar Dec 21 '21 20:12 iamrobert