The Wikipedia Signpost
The Wikipedia Signpost

< Previous (2006-11-13) | Next (2006-11-27) >

Technology report

Bugs, Repairs, and Internal Operational News

Tables can now be made sortable via JavaScript. Any table with class="sortable" will have arrows in each of its header cells, and clicking them will cause the table to sort according to that column's values. For instance, a table of countries could be sorted by the user according to country name, GDP, currency code, etc. A demonstration of the script can be viewed here. As always, the change might not be live for several days. (patch by Stuart Langridge, Lupin, Jonathan Snook, Robert Nyman, and Simetrical; r17803, bug 2001)

An extension written by Steve Sanbeg, Labeled Section Transclusion, was committed to the MediaWiki codebase in Subversion by Nick Jenkins. While it is not yet enabled on any Wikimedia site, it may be in the future. The extension allows pieces of pages to be transcluded without transcluding the entire page. It was requested for use on Wikisource in particular at bug 5881, where Dovi Jacobs and others noted how useful it would be for including things such as Bible verses.

A minor bug in retroactive autoblocking, where a user could be retroactively autoblocked even if the block failed, was fixed. (Andrew Garrett, r17802)

Several interface changes were made this week:

Some updates were made to non-English messages, specifically:

Internationalization help is always appreciated! See m:Localization statistics for how complete the translations of languages you know are, and post any updates to Mediazilla.


+ Add a comment

Discuss this story

These comments are automatically transcluded from this article's talk page. To follow comments, add the page to your watchlist. If your comment has not appeared here, you can try purging the cache.
== Sortable ==

According to [1], the original script sorts dates according to the European style (dd/mm/[cc]yy). Has it been customized for the various date formats that can be set at Special:Preferences? – Minh Nguyễn (talk, contribs) 22:19, 21 November 2006 (UTC)[reply]

Nope. Please feel free to submit any patches on Bugzilla, if you know JS. I don't see how this could have anything to do with the date preferences, though, since none of those takes either the dd-mm-yy or mm-dd-yy form. —Simetrical (talk • contribs) 23:53, 21 November 2006 (UTC)[reply]

Javascript

Ah - that is why the [show/hide] thing now works in classic? Excellent. And class="sortable" sounds great too. -- ALoan (Talk) 14:53, 23 November 2006 (UTC)[reply]

Can some kind person tell me how to get a sortable wikitable in List of Test cricket triple centuries? If I put in 'class="sortable"' and 'class="wikitable"' then I find that the second overrides the first. -- ALoan (Talk) 16:21, 23 November 2006 (UTC)[reply]
You can only define class once on an HTML element, so you'd put class="wikitable sortable". – Minh Nguyễn (talk, contribs) 23:16, 23 November 2006 (UTC)[reply]
Oh, thank you. I knew there had to be some magic incantation to make them work together. I tried joining them with a semicolon (class="wikitable; sortable") but it didn't work - I didn't think to just run them together. Thanks again. -- ALoan (Talk) 01:14, 24 November 2006 (UTC)[reply]

another Q on sortable

what are the least and greatest values among all data types? for example it would seem that all values and data types come before numbers (e.g. x, y, z, 0, 1, 2). So does that mean 9 is always the last on the list, or is there some special character that comes after it? This is an issue when i want to sort things that don't all have numerical values under a certain heading and i want them to be evaluated last. Right now the ugly fix is to give them a value of 999 written in white font. Here's a sample:

№ 1 № 2 № 3 Name Japanese Name Transliteration Stage
063 089 039 Apple ケーシィ Kēshī Basic
359 999 152 Bear アブソル Abusoru Basic
142 224 999 Cat プテラ Putera Basic
306 999 072 Dog ボスゴドラ Bosugodora Stage 2
190 122 999 Ear エイパム Eipamu Basic
065 091 041 Flight フーディン Fūdin Stage 2

Ideally, when sorting, numbers should go in ascending order, followed by blanks. What could we put in that would come after 9?

Dates also seem to be a problem, whether in Mmmm DD, YYYY or DD Mmmm, YYYY - presumably written numerically as yyyy-mm-dd works? (you will need to turn your date preferences off to see this properly, as it seems to sort by whatever is rendered by the browser, not the source)
№ 1 Mmmm DD, YYYY DD Mmmm, YYYY yyyy-mm-dd works
1 1 January 1990 January 1 1990 1990-01-01
2 2 January 1990 January 2 1990 1990-01-02
3 1 February 1990 February 1 1990 1990-02-01
4 2 February 1990 February 2 1990 1990-02-02
5 1 January 2006 January 1 2006 2006-01-01
6 2 January 2006 January 2 2006 2006-01-02
7 1 February 2006 February 1 2006 2006-02-01
8 2 February 2006 February 2 2006 2006-02-02
Names of people are also a problem, as it sorts by first name, not last name. Finally, it also seems to ignore images which come before the text - see the cricket list above. -- ALoan (Talk) 17:49, 29 November 2006 (UTC)[reply]

It needs improvement. A few thoughts:

  1. sort-first and sort-last classes, perhaps, to force cells/rows to sort before or after everything without the class.
  2. Better handling of different date formats.
  3. Number sorting should be more robust. I don't see why blanks should go after rather than before, by themselves (but see 1).

From what I've read of the code, anything not recognized will be sorted in Unicode code point order. —Simetrical (talk • contribs) 07:05, 30 November 2006 (UTC)[reply]

Oh, yes: sorting by last name instead of first is impossible, because it can't have any idea whether something's a name, and if it is, which part is the first name and which the last. Ignoring images is intended behavior. —Simetrical (talk • contribs) 07:08, 30 November 2006 (UTC)[reply]
Sorry, I was not clear enough: ignoring images is good. I wonder if there are any other things that should be ignored?
I wonder if it would be possible to add some kind of explict (but undisplayed) sort key? So you could add something like <sort="abc"/> to a cell to set where it should appear in a list, like pipes do for categories? -- ALoan (Talk) 10:27, 30 November 2006 (UTC)[reply]
The question is how to represent that in the HTML served to the user. It needs to be something that won't be noticeable for users without CSS/JS enabled, such as many cellphones. I guess inline <script>s or something could be added, or comments, but both seem like pretty messy ideas. —Simetrical (talk • contribs) 23:56, 30 November 2006 (UTC)[reply]
I have no idea how it works in the first place: I am only asking for functionality - how it would actually do it is a mystery to me! The current implementation seems like a pretty good first stab, but there are clearly a few areas that could be improced. Are the relevant developers watching here, or should we raise the issues elsewhere? -- ALoan (Talk) 10:19, 1 December 2006 (UTC)[reply]
The article on Collation may have some useful inspiration, especially the section about abbreviations. --Brandon Dilbeck 19:32, 2 December 2006 (UTC)[reply]

Sorting sems a bit haphazard

It doesn't seem to work very well at Bradford North (UK Parliament constituency)#Members_of_Parliament: the sorting is rather haphazard. --BrownHairedGirl (talk) • (contribs) 14:28, 27 January 2007 (UTC)[reply]

I don't see how so. Please give specifics as to expected and actual results. —Simetrical (talk • contribs) 03:45, 28 January 2007 (UTC)[reply]

Numbers with two commas do not sort correctly

The sorting script has problems handling numbers containing more than one comma. If you sort this table you'll see that it ignores anything after the second comma. For example: 1,025,481 is placed between 1,024 and 1,206.

Numbers Currency
1,025,481 $1,025,481
205 $205
20,799,886 $20,799,886
101,742 $101,742
213,233 $213,233
20,798 $20,798
1,024 $1,024
20,800 $20,800
1,026 $1,026

Not sure if this is the proper place to report the problem, but since others have done so I figured I would add one that was causing a problem for pages I work on. Thanks. -- Zyxw 10:39, 28 January 2007 (UTC)[reply]

Looking through sorttable.js I noticed it handles currency differently than numbers. I've added a column to the above table which contains the same numbers preceded by a dollar sign. If you click on numbers column it sorts incorrectly, but it you click on the currency column it does sort correctly. -- Zyxw 16:39, 29 January 2007 (UTC)[reply]

After a bit more research I found Meta:Help:Sorting which mentions this problem. It was also reported as T10115 on 2007-01-19. At the bottom of that page it mentions that this bug has been fixed in the JavaScript code available at Meta:Help_talk:Sorting. I guess the only question now is when the updated code will be implemented. -- Zyxw 18:52, 29 January 2007 (UTC)[reply]



       

The Signpost · written by many · served by Sinepost V0.9 · 🄯 CC-BY-SA 4.0