Last modified: 2013-07-25 07:07:18 UTC
I would like to provide permalinks to a statistics page with the statistics sorted in a particular order. Specifically http://translatewiki.net/wiki/Translating:IHRIS/stats sorted by the "IHRIS Manage" or "IHRIS Common" column so that I can point to the page in emails, blog posts or what have you and have the translation coverage be immediately clear -- that is, not require the person clicking the link to also have to select a sort order. When I spoke to Krinkle about making this a generic feature for sortable wikitables, he suggested I, instead, request that it be added to the extension that I want since, in the general case, it would be difficult to pick *which* sortable table on the page needed to be sorted.
It would not be difficult to tell the sortable code how to sort by default.
That's right. If not already, a way to set the default column for sorting inside the wikitext when creating the "{| class='wikitable sortable' ... " should be simple. I hadn't thought of it that way, if that's acceptable to TranslateWiki and suffices in Mark's request we can do that. But if it's not something we'd want for all viewers of the /stats pages by default, then, imho, we only have two options: 1) Create some way, specifically on translatewiki.net, to process url parameters and manipulate a sorting-command to the table. This code could be places in MediaWiki:Common.js and checking the namespace and subpagename. 2) A much cleaner, but also more complex (imo overkill if this is the only needed advantage), implement this "/stats" functionality as a SpecialPage in the Translate-extension. Since it would output it's stuff from PHP it could use TablePager (or some other method), and could easily use url-parameters to control the initial sorting in the HTML output (this is supported by default in TablePager). or, 3) Not exactly as request but might forfill the need, implement a way to tell the tablesorter javascript which column the default sort should be (ie. {| !class="defaultsorted"|myheading |} ). This is the easiest to implement, but doesn't allow you to choose it (it would be hardcoded in the wikitext which column the default is), and would affect all viewers of the page. Except for 2), I can implement without too much work. Let me know (or assign it to me), after a decision has been made :-)
Being bold and choosing (1). (2) is not worth it. (3) doesn't work for this use case as all columns are the same except language which would still be the default; but if it's so easy to fix, it's worth another bug, all other wikis would appreciate it I think given that changing default sorting to a table is quite a pain.
https://gerrit.wikimedia.org/r/28761
Not fixed yet, patch waiting for fixing and review. Unassigning from Krinkle, Niklas and I are working on it.
Example URLs https://translatewiki.net/w/i.php?title=Special:LanguageStats&suppresscomplete=1#sortable:2=asc https://translatewiki.net/wiki/Special:MessageGroupStats/out-waymarked-trails-help#sortable:3=desc