Page MenuHomePhabricator

Numeric table sorting broken
Closed, ResolvedPublic

Description

Author: bluehairedlawyer

Description:
A column which should sort numerically but which contains even one non-numeric element will not sort correctly or will produce strange results. It seems to sort numerically but leaves lots of numbers out of place at the bottom of the table.

This appears to be caused by recent diff:

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js?r1=42576&r2=42715

which allows ts_parseFloat to return a non-numeric value. This is rather pointless as the return value isn't see by anything other than javascript's table.sort() which doesn't appear to like it very much. Although browsers could handle this better, it affects (as far as I can see) Firefox and Safari.

For a (clearer) example see:
http://en.wikipedia.org/wiki/User:Blue-Haired_Lawyer/sandbox2


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)_per_capita

Details

Reference
bz17105

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 10:30 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz17105.
bzimport added a subscriber: Unknown Object (MLST).

bluehairedlawyer wrote:

fix numeric sorting

Attached:

bluehairedlawyer wrote:

Ideally non-numeric entries in numeric lists (for example unranked entries in GDP lists) should sort to the end of the list regardless of the way the list is being sorted.

bluehairedlawyer wrote:

This really needs to be fixed. I've increased the priority.