User:Tcncv/Table Sort Demo

From Wikipedia, the free encyclopedia
Jump to: navigation, search

This page contains several tables used to demonstrate proposed colspan/rowspan enhancements to Wikipedia table sorting functions. To view the enhancements in operation, you must add importScript('User:Tcncv/sorttables.js'); to your monobook.js file (or appropriate xxx.js file for your chosen skin).

In addition to these tables, you can try the functionality on your own tables (on a suitable test page - not mainspace) by adding class="wikitable tsx_sortable" to the table header. The class="autorowspan" attribute can also be added to columns or the entire table to maximize cell merge operations.


Test table adapted from Swimming at the 2008 Summer Olympics[edit]

Another example: 2008 Olympics Medal table[edit]

Note that the Rank column has a number of merged cells, but when the table is sorted, they are split, so that the table layout is not corrupted. If you sort by Rank again, previously merged cells are recombined. Also, if you sort a number of adjacent columns right to left (uch as Bronze, Silver, then Gold), cells are merged in all these columns. (That may not be desirable in all cases, but for this example, its been enabled.)

Another example: 2008 Olympics Medal table (with multirow header)[edit]

Note that the Rank column has a number of merged cells, but when the table is sorted, they are split, so that the table layout is not corrupted. If you sort by Rank again, previously merged cells are recombined. Also, if you sort a number of adjacent columns right to left (uch as Bronze, Silver, then Gold), cells are merged in all these columns. (That may not be desirable in all cases, but for this example, its been enabled.)


What happens when rowspan and colspan conflict[edit]

Overlapping row spans and column spans are invalid in HTML and are not supported by the updated sortable script. These examples are included just to see how they render.

Examples from Help talk:Sorting[edit]

... plus a small sample of mainspace articles that currently have sorting problems.

Example 1[edit]

From Statewide opinion polling for the Democratic Party presidential primaries, 2008#Delegate table and polling data referenced from Help talk:Sorting#Rows/headers above sortable row.

Demonstrates multi-row headers with rowspans and fixed (unsortable) footer.

Example 2[edit]

Example from Help talk:Sorting#Can this be got working?

Demonstrates multi-row headers with rowspans and colspans.

Example 3[edit]

From List of Colorado Avalanche players#Goaltenders referenced from m:Help talk:Sorting#Table with colspanned cells.

Demonstrates multi-row headers with rowspans and colspans.

Example 4[edit]

From Comparison of email clients#Protocol support referenced from m:Help talk:Sorting#problem with 2 row - header - table.

Demonstrates multi-row headers with rowspans and colspans. Sort icons are suppressed on some header cells. Also changed "sortbottom" to "unsortable" to stablize the footer rows.

Example 5[edit]

From Anamorphosée#Singles

Demonstrates multi-row headers with rowspans and colspans and rowspans in the data.

Example 6[edit]

From In Blue#Charts and certifications

Demonstrates rowspans in the data.

Example 7[edit]

From List of British Columbia senators#Current

Demonstrates a colspan in the header that previously caused sort icons to sort the wrong columns.

Example 8[edit]

From TV Land Award#Past winners

Demonstrates rowspans in the data.

Example 9[edit]

From Eurovision Song Contest winners#Winners

Demonstrates rowspans in the data and the use of unsortable and autorowspan column options added by other editors.

(Note: Editors of that article has already marked up the table, even though this functionality is not yet generally available.)

Mix of colspans and rowspans[edit]

The following data is not real, it has been adapted/fabricated to test assorted complex rowspan/colspan combinations. Note that the data in the first set of columns matches the data in the second set.


An example from MediaWiki talk:Common.js[edit]

Another table with a header containing rowspan and colspan from this discussion.

  1. ^ Australian Charts - The Corrs - In Blue
  2. ^ a b c The Corrs Awards
  3. ^ Austrian Charts - The Corrs - In Blue
  4. ^ IFPI Austria
  5. ^ a b Belgium Charts - The Corrs - In Blue
  6. ^ Belgium Certification
  7. ^ a b c d e f g h i Planet-Corr - The Corrs - In Blue
  8. ^ CRIA
  9. ^ IFPI
  10. ^ French Charts - The Corrs - In Blue
  11. ^ a b c d e Spanish Wikipedia
  12. ^ Finnish Charts - The Corrs - In Blue
  13. ^ German Charts - The Corrs - In Blue
  14. ^ Music Industrie
  15. ^ Sinar Harapan
  16. ^ a b c d e f g h i j k l m Tripod
  17. ^ Netherlands Charts - The Corrs - In Blue
  18. ^ New Zealand Charts - The Corrs - In Blue
  19. ^ "New Zealand Top 50 Albums Chart" Retrieved October 21, 2001.
  20. ^ Norwegian Charts - The Corrs - In Blue
  21. ^ Swedish Charts - The Corrs - In Blue
  22. ^ Swiss Charts - The Corrs - In Blue
  23. ^ Every Hit - The Corrs - In Blue
  24. ^ a b All Music
  25. ^ Four countries tied for first place at the 1969 Contest. As no tie-break structure was in place, all four were declared joint winners.


Cite error: There are <ref group=N> tags on this page, but the references will not show without a {{reflist|group=N}} template (see the help page).