joequery/Stupid-Table-Plugin

How can we keep null rows on the bottom?

Closed this issue · 2 comments

If I have 10 rows and 3 are empty, they will always appear on the top for alphabetical. What I would love is if the sorting could keep empty rows on the bottom when sorted. Rather than ask for this to be added, which might be seen as unnecessary bulk, how would you recommend I extend this to add that functionality myself?

I used data-sort-value="0" as a sufficient solution. They're not always on the bottom, but at least they're not on top for my numeric sorted columns.

FYI one other option is to set separate sorting functions for ascending and descending.

<th data-sort="blanksAsc" data-sort-desc="blanksDesc">Column</th>

Then in the blanksAsc sorting function, sort the blank value after the other (so it goes 1, 2, 3, blank), and in the blanksDesc function, sort blanks before the other (so it goes 3, 2, 1, blank).