tristen / tablesort

:arrow_up_down: A small tablesorter in plain JavaScript
https://tristen.ca/tablesort/demo/
MIT License
1.1k stars 179 forks source link

Order of sorted column groups #176

Open eighthday opened 5 years ago

eighthday commented 5 years ago

Hi,

If I sort a column, the sort is done correctly, but how do i control the order of the grouped rows.

e.g If I sort by sector I get a group of "Architecture & Property" projects together, but they are showing oldest to newest. How can I change this to newest to oldest or alphabetical ?

after sort: D2E | Architecture & Property | 2002 Creative Developments | Architecture & Property | 2006 Frances Tobin | Architecture & Property | 2007 Comber Rowe | Architecture & Property | 2013

Codepen here: https://codepen.io/eighthday/pen/OreoJx

thanks!

Macro-Jackson commented 5 years ago

As you can read here: https://github.com/tristen/tablesort/issues/86 Tristen was not sure in 2015. Maybe we can convince him that it is important. :-)

As I can see it, it should not be too hard to handle. And IMHO a big addition to this setup. I would really like this too. I have also a table with duplicate sets of data which I do like to sort in two columns.

https://github.com/tristen/tablesort/blob/gh-pages/src/tablesort.js Seems something should be edited around line 200. But my knowledge here is limited. I am not a JS guru in any sense.