Page MenuHomePhabricator

Add sorttop option for jquery.tablesorter
Closed, ResolvedPublic

Description

For the COVID-19 infection tables, English Wikipedia wants to put the totals at the top instead of at the bottom. This isn't really supported by jquery.tablesorter, so they implemented an awkward workaround where the totals are part of the header. This has the confusing side effect of putting the sort buttons on the totals instead of the real headers. Several other wikis have now followed this pattern as well: ko, ru, tl, vi, etc. Here's a screenshot:

Screen Shot 2020-03-30 at 10.55.01 PM.png (333×436 px, 72 KB)

It would be nice if jquery.tablesorter added handling for a "sorttop" class similar to the existing "sortbottom" class, so that this could be better accommodated. The "sorttop" row would stick to the top, but not be assigned the sort buttons.

Event Timeline

@Krinkle - I'm not sure who originally wrote jquery.tablesorter (as the history got broken by a file move), but my guess would be you :) Any thoughts on this?

An alternate idea would be a way to assign the sort buttons to a particular row in the header, but that seems hacky.

(When there are multiple header rows, the sort buttons are added to the bottom-most row with the largest number of cells, to support "grouped" headers – so you could fiddle around with that too.)

@Krinkle - I'm not sure who originally wrote jquery.tablesorter (as the history got broken by a file move), but my guess would be you :) Any thoughts on this?

It was created by diebuche (Leo Koppelkamm) in 2011. I've since done some of the maintenance.

@Tchanders - If you end up implementing the suggested solution in the description (which is the least hacky solution), let me know and I can update all the tables on-wiki.

Change 588705 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] jquery.tablesorter: Allow top sorting via 'sorttop' class

https://gerrit.wikimedia.org/r/588705

Change 588705 merged by jenkins-bot:
[mediawiki/core@master] jquery.tablesorter: Allow top sorting via 'sorttop' class

https://gerrit.wikimedia.org/r/588705