https://bugzilla.wikimedia.org/show_bug.cgi?id=35526
Web browser: ---
Bug #: 35526
Summary: jquery.tablesorter sort order not stable
Product: MediaWiki
Version: unspecified
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: normal
Priority: Unprioritized
Component: Javascript
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
The current tablesorter algorithm is "unstable": it does not preserve (or sort
consistently) the relative order of rows where the cell content is equal.
For example, in the enwiki:VPT example linked below, clicking the "Col 1" sort
button twice in the table below should preserve the order of rows 2 to 8 (or
invert them then restore them). But instead, the tie-break rows sort
pseudorandomly (returning to the orginal order after 6 clicks instead of 2).
It is confusing for tables to change the order of rows with identical sort
values. Since Wikipedia articles are not expected to contain extremely large
tables, computational optimisation should be less important than intuitive
operation.
The current jquery.tablesorter.js claims to use a merge sort algorithm, but
apparently not a stable one.
At present, enwiki is at version 1.19wmf1 (r114429). I do not know whether this
also affects versions prior to 1.19.
Live JavaScript:
http://en.wikipedia.org/w/resources-1.19/resources/jquery/jquery.tablesorter.js
SVN:
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.tablesorter.js
I think Bug 31255 is a different but similar issue.
Example at:
http://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Unstable_tablesorter_algorithm
Wikitext of example table:
{| class="wikitable sortable"
! Col 1 !! Col 2 !! Col 3
|-
| aa || aba || 1
|-
| ab || abb || 2
|-
| ab || abc || 3
|-
| ab || abd || 4
|-
| ab || abe || 5
|-
| ab || abf || 6
|-
| ab || abg || 7
|-
| ab || abh || 8
|-
| ac || abi || 9
|}
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l