Admin Forum:Sortable Tables

I'm trying to add the functionality of sortable tables to my wiki. I've searched through the help files and such, and I found the statement:

"Tables can be made sortablehttp://en.wikipedia.org/wiki/Sorting via client-side JavaScript with class="sortable" (in combination with the usual formatting: class="wikitable sortable"). This works in MediaWiki 1.9 and above, which is installed in all Wikimedia projects."

The problem is that this doesn't really help as I don't know what class="sortable" is and it doesn't seem to exsist on my wiki. I guess my question is what code do I need to put where so that I can make the wiki's tables sortable like they show Here: http://meta.wikimedia.org/wiki/Help:Table and Here:http://meta.wikimedia.org/wiki/Help:Sorting


 * Alright, I did get it to work by looking at the code, and tweeking something, and also Sortable tables don't appear in the preview, so you have to actually publich the code to make them function. User:Bond_em7 16:09, March 21, 2012 (UTC)


 * The sorting doesn't work in previews because Wikia has disabled JavaScript when editing in the Wikia skin. The sorting does work in previews when editing with the Monobook skin. If you really want to check the sorting before publishing an edit, you can switch to Monobook in your preferences. --Gardimuer { ʈalk } 01:17, March 22, 2012 (UTC)

Sorting Dates
Pardon me for making a new section here.

My wiki is making use of a lot of sortable tables, but the problem is that it only sort alphabetically (or perhaps in ASCII order) even when I put this in the header code, as Meta-Wiki instucted: data-sort-type="date" As you can see in this article, date sorting simply doesn't work. I've yet to try sort by name in other articles. Is it unsupported or something? Do I need to upgrade the wiki version? Please help! -- Mfaizsyahmi  (talk) 06:44, March 31, 2012 (UTC)


 * I can find no mention of "data-sort-type" in Wikia's JS code. jquery.tablesorter.js doesn't seem to be loaded either. Maybe you should try to load that script manually... --
 * EDIT: On that MediaWiki page it says "data-sort-type" is supported from version 1.16.5 on. Wikia uses 1.16 if I'm not mistaken. I heard some time later this year they will upgrade to 1.19. Until then there's no date-sorting. --


 * Too bad. :( -- Mfaizsyahmi  (talk) 08:51, March 31, 2012 (UTC)


 * I suggest you read Wikipedia:Help:Sorting and Wikipedia:Help:Sorting. The information there may help you sort the table rows the way you want. --Gardimuer { ʈalk } 10:13, April 1, 2012 (UTC)
 * Alright. It seems that date sorting will work on only a few formats. I've abbreviated the month names and it now sort properly. Thanks! -- Mfaizsyahmi  (talk) 04:58, April 2, 2012 (UTC)

P.S. Still not trying to sort by name, too lazy for it.


 * I just checked and it says 9 Mar 2012 > 2 Feb 2012 > 2 Mar 2012. Looks to me like it's still sorting alphabetically. Have you tried the hidden key suggestion? It would look like this:


 * YYYY-MM-DD can be sorted alphabetically. --
 * Date sorting has worked in my wiki, on the condition that you adhere to the formats in the help page Gardimuer had suggested. That means abbreviated month names (Jan, Feb, Mar,...) works, while full month names doesn't. -- Mfaizsyahmi  (talk) 07:40, April 2, 2012 (UTC)


 * This is what I just saw: 9 Mar 2012 > 2 Feb 2012 > 2 Mar 2012. That looks wrong to me.


 * The MediaWiki software uses PHP's strttotime function which has no problem with full month names:


 * All of these output the same timestamp. If date-sorting worked, it wouldn't matter how you write the month names.


 * It doesn't work. Sorry! --
 * Ah, didn't notice that. I don't mind much though, and would rather wait for the MediaWiki update. Until then, hidden sortkey would have to do. Creating templates for the purpose might be feasible, but it'll be tedious for the editors. Thanks to point that out! -- ''Mfaizsyahmi (talk) 20:35, April 2, 2012 (UTC)