Wikipedia talk:Wikipedia Signpost/2006-11-20/Technology report

Sortable
According to, 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)
 * 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)

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)


 * 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)


 * You can only define  once on an HTML element, so you'd put  . – Minh Nguyễn (talk, contribs) 23:16, 23 November 2006 (UTC)


 * 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)

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:

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)


 * 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)

It needs improvement. A few thoughts: 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)
 * 1)   and   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).
 * 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)


 * 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 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)
 * 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 s or something could be added, or comments, but both seem like pretty messy ideas. —Simetrical (talk • contribs) 23:56, 30 November 2006 (UTC)
 * 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)
 * The article on Collation may have some useful inspiration, especially the section about abbreviations. --Brandon Dilbeck 19:32, 2 December 2006 (UTC)

Sorting sems a bit haphazard
It doesn't seem to work very well at Bradford North (UK Parliament constituency): the sorting is rather haphazard. --BrownHairedGirl (talk) • (contribs) 14:28, 27 January 2007 (UTC)
 * I don't see how so. Please give specifics as to expected and actual results. —Simetrical (talk • contribs) 03:45, 28 January 2007 (UTC)

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.

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)

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)

After a bit more research I found Meta:Help:Sorting which mentions this problem. It was also reported as 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)