Help talk:Sortable tables/Archive 2

Can this be got working?
In the header, it would be nice if the sort thingies were just where they're not & not where they are. Jɪmp 08:32, 27 March 2008 (UTC)


 * Like this?


 * 199.125.109.19 (talk) 22:28, 31 March 2008 (UTC)


 * Another table where this is a problem is Template:ISO 15924 script codes and Unicode as of revision 10:38, 20 May 2010. &#x2013; b_jonas 21:21, 20 May 2010 (UTC)

Define column to be sorted by default
when i have !Name!!Surname!!Height: Name is sorted by default. Now I'd like to have Surname sorted by default but still as the second column. Is it possible? --Subfader (talk) 20:35, 27 March 2008 (UTC)


 * I think it does not sort by default: it displays the original page in the order the wikitext is arranged.  So to have it default sorted, just rearrange the wikitext.  —EncMstr 21:00, 27 March 2008 (UTC)


 * I had a similar need on our internal documentation wiki and having to manually sort the wiki text was not feasible in my case. It's a table of project statuses that I wanted sorted by the status column.  Every time a project status changed (dev->qa for example), that meant copying/pasting the row and trying to manually keep everything in the right spot... yuck.  Anyway, enough of my story.  I've been fiddling with the wikibits.js and made some changes that seem to be working for us (additions in bold):

function ts_makeSortable(table) { var firstRow; var reverseSort = false;       // flag indicating whether it should be reverse order var defaultSortAnchor = null;  // anchor tag that is the sort control for the default sort column if (table.rows && table.rows.length > 0) { if (table.tHead && table.tHead.rows.length > 0) { firstRow = table.tHead.rows[table.tHead.rows.length-1]; } else { firstRow = table.rows[0]; }   }    if (!firstRow) return; // We have a first row: assume it's the header, and make its contents clickable links for (var i = 0; i < firstRow.cells.length; i++) { var cell = firstRow.cells[i]; if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) { cell.innerHTML += '   '; // if the class contains "defaultsort" then sort on this column if ((" "+cell.className+" ").indexOf(" defaultsort ") > -1) { // look for the "sortheader" anchor tag and use it as the sort control var cellChildren = cell.childNodes; for( var j = 0; j < cellChildren.length; j ++ ) { if( cellChildren[j].nodeName == "A" && cellChildren[j].className == "sortheader" ) { defaultSortAnchor = cellChildren[j]; }         }          // if the class contains "reverse" then do a reverse sort if ((" "+cell.className+" ").indexOf(" reverse ") > -1) { reverseSort = true; }       } }   }    if (ts_alternate_row_colors) { ts_alternate(table); }   // if we found a default sort anchor, then do the sort if( defaultSortAnchor != null ) { ts_resortTable( defaultSortAnchor ); if( reverseSort ) { ts_resortTable( defaultSortAnchor ); }   } }


 * With this change, all you need to do to make a column sortable is put  in the header cell of the column you want to sort on (note: if you have this on multiple columns, the last one wins).  You can also add the "reverse" class if you want it to reverse sort.  This is probably an inelegant solution but it's working great for us. --Aylwyne (talk) 12:39, 6 June 2008 (UTC)
 * Hi. i added the code  like this:  but the table still does not automatically sort. Anyone know what the problem is?  ќמшמφטтгמ torque 05:31, 21 August 2008 (UTC)

Was this ever resolved? I would also like to define the column that is the default sort, but the above  does not work. Is this code still even there?FourTildes (talk) 22:33, 4 April 2009 (UTC)

Slow - what method?
Sorting 1,000 or so items is very slow (example: list of chess grandmasters). What method does the sorting use? Could it be faster? Bubba73 (talk), 22:35, 30 March 2008 (UTC)


 * It uses http://en.wikipedia.org/skins-1.5/common/wikibits.js containing in "newRows.sort(sortfn)" the sort function of Javascript itself. Thus the method used could depend on the browser.--Patrick (talk) 22:51, 30 March 2008 (UTC)


 * If the input list was initially sorted, would that make it come up faster? Bubba73 (talk), 23:01, 30 March 2008 (UTC)


 * JavaScript sorting is not done initially, but only after pressing the sort link, so I do not understand what you mean. Of course, putting the wikitext in the most commonly desired order is useful because it saves doing any JavaScript sorting to get that order.--Patrick (talk) 23:56, 30 March 2008 (UTC)


 * When I go to list of chess grandmasters in IE7, it takes a long time for it to come up initially (but not so long in Firefox). I was wondering if it was initially running the sort, which is taking a long time.  But if it doesn't sort until someone click, then that can't be it.  Is there anything simple that can be done to make that article come up faster?  Bubba73 (talk), 15:02, 31 March 2008 (UTC)
 * The slow load time is a consequence of all the flag templates. Remove them and it will be much faster.  — Andrwsc (talk · contribs) 20:36, 1 April 2008 (UTC)


 * ::::: I thought that might be the case, and it was discussed on the article's talk page, but someone did a test and they found that the flags were not the problem. (See list of chess grandmasters talk page.)  Bubba73 (talk), 20:43, 1 April 2008 (UTC)
 * It's not clear from the talk page discussion what browsers were used for that test, but it is a known problem that special code added to MediaWiki:Common.js for PNG images (which is how flag icons are thumbnailed on server caches) slows IE page loads. In any case, I think you might be better off without flags on that page anyway, for WP:Manual of style (flags) issues. — Andrwsc (talk · contribs) 21:04, 1 April 2008 (UTC)


 * Right. I first noticed the slowness problem with IE7. Then when I tried Firefox it was much faster.  Thanks for the MoS link - I had already questioned whether there should be flags or not.  Bubba73 (talk), 22:30, 1 April 2008 (UTC)

static columns
Is there a way of disabling sorting on one or more columns? I see the static columns example but it's not ideal building it with two separate tables.

Anyone? Cnbrb (talk) 21:50, 9 April 2008 (UTC)
 * I don't think there's any supported method. There's probably some way to do it by hiding the handles, but I don't know how.  Why do you want to disable sorting some columns?  —EncMstr 22:07, 9 April 2008 (UTC)

Thanks - sometimes I have a table where a reader might want to sort (say) column 1 alphabetically but subsequent columns might not be something worth sorting (e.g. a notes column). Hiding the handles would be the kind of thing I was thinking of. Cnbrb (talk) 23:15, 9 April 2008 (UTC)
 * Even sorting a notes column is useful to collect the rows which have a note entry—and the same note. If that seems haphazard, revising the note entries to make them more friendly, perhaps with standard leading keywords or tags.  Granted, there are a few tables where the columns make little sense to sort, but that's hardly a reason to prevent it.  Perhaps someone, somewhere has a use.  —EncMstr 23:38, 9 April 2008 (UTC)


 * I think I have a use. In the table at List of Royal Air Force air chief marshals, I would like to create a new column on the left hand side which no matter which of the sortable columns has been clicked, it always displays 1, 2, 3, 4, ...  This would enable readers to rapidy work out who was promted 20th (say) or had the 65th (say) longest time in rank etc.  Any ideas on how to do this (apart from 2 nested tables which will not really work as the row hight in the right-hand sub table varies)?  Thanks Greenshed (talk) 23:35, 27 November 2009 (UTC)

Requesting to view wikitable code for Help:Sorting
I'd like to view the code for several examples used at Help:Sorting However, that page is protected from editing. Is there another location where the code is able to be viewed?

Specifically, I would like to see the wikitable code for the very last example which should show how to correctly use the "sm=n" solution for forcing numerical sort.

Quote: Najevi (talk) 15:09, 20 April 2008 (UTC)
 * Sortable version of Template:Climate in Middle East cities, using smn to specify numeric sort mode

Ha! Found the source code at http://meta.wikimedia.org/wiki/Help:Sorting#Examples


 * style="text-align:center;" |-3&deg;C
 * style="text-align:center;" |7&deg;C

Najevi (talk) 15:21, 20 April 2008 (UTC)

Only some of the numbers will sort
In the article International wheat production statistics, years 2002-1999 work fine, while years 1998-1996 don't sort correctly. Is there any way to fix this, or is this a known "bug"? Esn (talk) 04:49, 23 April 2008 (UTC)
 * Hold on, I think I see what is causing it. The problem columns all have the entry "0NA" (signifying "negligible" or "not on the list in that year"). Is there any way to say "n/a" in a table without saying "0" (which wouldn't technically be correct)? Esn (talk) 04:53, 23 April 2008 (UTC)

Please help: Sortable table provides one round of correct sorting, another of incorrect sorting
Try this: visit the birth control comparison table, and click the button to sort by "perfect use" rates, once. Only once. See the two "no data" items at the top, there? OK, now click it again: what's happening is that it is being sorted in a different way. I don't know the name for it, but if you look at the very top of the block of blue items in "perfect use", and start moving your eyes up line by line, you will see it go from 2 to to 20 to 26. Clearly it is being sorted in a way that make mathematical sense, but is useless for that table's intended comparison. Is there a way to make the sortable table not do this? Thanks! Whistling42 (talk) 02:45, 25 April 2008 (UTC)


 * Interesting. I speculate that it determines the type of comparison (string or numeric) to use by looking at the first element in the table.  Once it's sorted so that "no data" is on top, it then uses a string comparison.  To fix, use the  template.  For the no data, I expect the sort key would be 0 (zero).  —EncMstr (talk) 02:53, 25 April 2008 (UTC)


 * Thanks for your response. I understand, somewhat, but I don't know what you mean by "first element in the table".  It is definitely switching between numeric and string.  I'm not really sure how to use the template; in my previews (using the Sort template) using 0, 100, and a blank space, it still didn't work properly.  Any ideas?  Care to tinker with it?  The only method I found that works is to remove the "no data" and "see note" text entirely, but I would rather keep the text if there is a way.  Whistling42 (talk) 03:42, 25 April 2008 (UTC)


 * This diff shows the changes I intended. I keep meaning to look up how to make sort not use a string comparison, but I just padded it with leading zeros and made it work okay.  If you don't like "no data" sorting as though its value is zero, it should be clear now how to change that.  —EncMstr (talk) 04:08, 25 April 2008 (UTC)

Error on Mediawiki version ?
On the help page says "This works in MediaWiki 1.9 and above", but on MediaWiki, the las version is: "2008-03-20: 1.12.0 quarterly release". So we should wait some month for 1.9 version, and all Mediawiki projects has a very unstable version!? —Preceding unsigned comment added by 190.18.45.41 (talk) 02:22, 14 May 2008 (UTC)
 * The versions are sorted weirdly. Version 1.12.0 is "above" 1.9, that is, 1.12.0 was released after 1.9.  You might check out Version lifecycle for information on the releases. JackSchmidt (talk) 04:55, 14 May 2008 (UTC)

helpful
This page was very helpful! thanxArdeshire Babakan (talk) 18:10, 24 July 2008 (UTC)

Do not edit this copy?
'''This is a copy of the master help page at Meta. Do not edit this copy.'''

That is what I see at the top of the article Help:Sorting, followed by

Edits will be lost in the next update from the master page.

Yet I see that edits have been made to the copy and do not see any update. Is this an old out of date message? It confused me, because I first read the sort mode section (ignoring the top message out of habit) and read the "sm=n" and "m:Template:smn". I found smn does not work for me, so I look at meta:Help:Sorting, where smn mention has recently been removed. Does this mean this copy page is due an update?

Also, at the very end I see: "In particular, both the Template:Smn and the sm=n trick do not work on Wikipedia." -84user (talk) 03:56, 5 October 2008 (UTC)

Numeric sort test
This table should sort according to wikipedia's Help:Sorting but not according to according to meta:Help:Sorting (maybe because meta has removed the support for formats like 4.32×104). Today it does not sort properly.

This table should sort according to both wikipedia and meta, and do sort for me today:

-84user (talk) 03:56, 5 October 2008 (UTC)

Sorting Negative Numbers
Sorting negative numbers seems to work when the ASCII hyphen/minus "-" (0x002D) is used. It seems that the problem may be caused by the Unicode Minus Sign "−" (0x2212). - Unimath (talk) 00:13, 11 October 2008 (UTC)


 * Interesting. The tables above use standard ASCII minus and the second one sorts correctly numerically. Let's test sorting with a Unicode Minus Sign here:


 * Results: With Unicode minus the above table sorts with this cycle: 1. numeric descending, 2. numeric ascending, 3. alphabetic descending, 4. alphabetic ascending, and repeat. So you are right - unicode breaks sorting. -84user (talk) 10:40, 11 October 2008 (UTC)

Center
How do you make a box be placed in the center? — Nuclear  Vacuum  23:52, 27 November 2008 (UTC)

Max rows for sort = 50?
Is there a maximum on the number of rows displayed for a sorting table? I have a table with 54 rows, and only the first 50 display. Those work fine, I just need the last 4 to show. Thanks in advance, Chuckiesdad (talk) 06:13, 30 November 2008 (UTC)
 * Withdrawn by original poster, there are lots of functional sorting tables with hundreds of entries, so this is not a Wiki problem, I'll check my browser and editor for bugs. Regards, Chuckiesdad (talk) 22:18, 30 November 2008 (UTC)

numeric sort with 1+ non-numeric elements doesn't work on firefox 3.0.4
It seems that if there are one or more 'non-numeric' elements in an otherwise numeric column, then it does not sort properly in firefox 3 (I tested with 3.0.4 on windows xp). You can see this on the first 'numbers' table in the Help:Sorting page (with 'ghi' as one of the elements).

Additionally, in IE6 and IE7, after the page first loads and you try to sort a table of the aforementioned description, a first click on the sort button will not properly sort the table. The second and subsequent clicks seem to work properly. You can also see this problem here: United States cities by crime rate by sorting by 'violent crime'. —Preceding unsigned comment added by Tfischer (talk • contribs) 20:51, 15 December 2008 (UTC)

Could somebody take a look at this article?
I am trying to merge some wrestling title articles per a AFD discussion. The problem I am having is with the autosorting (since I am merging articles that existed just for how long they held a title with a list of chronological champions, so there has to be a way to sort based on how long they held the title). I can't seem to get it working right now. The article is List of WWE Intercontinental Champions. Could somebody experienced with autosorting take a look at it for me?  TJ   Spyke   05:38, 21 December 2008 (UTC)

Sorting diacritic letters
What is the correct sorting order for words and names with diacritic letters? Various languages using the Latin alphabet sort their diacritic letters differently. In Swedish for instance, Å, Ä and Ö are the final letters of the alphabet. I assume that words with diacricits should be sorted without them, but I can't find any wikipedia rule about this. In one help page ASCII is stated to be the sorting order for strings, but that would be a bit confusing since diacritics are not placed next to their "main" letters. Mad Greg (talk) 12:15, 28 December 2008 (UTC)

Blank spaces treated as zero
I am struggling to find a solution to the sortable table at List of Calgary Flames draft picks that would allow the list to sort empty cells as being less than zero. I could use in each cell, but in a table of this size, it would introduce a massive amount of overhead. In fact, in testing that as a solution I found editing the table to be incredibly difficult as both IE and Firefox struggled to handle the amount of data. Unfortunately, using emdashes rather than blank cells only managed to completely break sortability. Does anyone have any suggestions on how to resolve this problem? Thanks, Resolute 23:54, 12 February 2009 (UTC)

Filterable
Hi guys, is there a way to make tables in wikipedia filterable?

Similar to this: http://mguglielmi.free.fr/scripts/TableFilter/filter-sort.htm --TheBigJagielka (talk) 00:10, 30 April 2009 (UTC)

Synch this copy with the one on meta?
This version of Help:Sorting lacks many good updates that have been made to meta:Help:Sorting. For example, the confusing business about "sm=n" has been removed from meta's copy. Should these differing versions be synchronized now? --fjarlq (talk) 09:51, 9 May 2009 (UTC)


 * Per m:Help talk:Sorting, I have manually synched this up with meta. --fjarlq (talk) 10:55, 13 May 2009 (UTC)

Sorting with dates before 10,000 BC
It seems that the method for date sorting only works for dates after 10,000 BC. How do I make a sortable column for dates before that date? In the table in question, I have dates from before 10,000 BC until around 800 AD. As the table is still in preparation, I am not sure yet what the exact dates will be. Most likely I will not have any month/day information to sort though. bamse (talk) 02:56, 13 May 2009 (UTC)

Filter OUT, not IN
What I'd like to see is a way to pick one cell and filter OUT every row with that value in that column. This should be repeatable (same or different columns), without adding back the items filtered out (until you click refresh or something). This way you could start with a large list and gradually remove items that fail one or another criteria, until you've got the list whittled down to just the items that are truly interesting.

Ideally sorting would NOT interfere with this; it would simply sort the items you have not filtered out. —Preceding unsigned comment added by 74.166.109.199 (talk) 01:30, 21 May 2009 (UTC)

The "Sorting the wikitext of a table" section
I don't understand this section at all. What is it saying? Is there something wrong with the markup or is it supposed to look like that?

Additionally, is it possible to create a table that is sorted by one of its columns by default? Shreevatsa (talk) 19:27, 25 May 2009 (UTC)
 * I repeat the question of Shreevatsa verbatim. Someone please answer! (I think the help page should have a header "sorting tables by default," even if the content is, "it can't be done.")  Andrew Gradman talk/WP:Hornbook 20:49, 1 August 2009 (UTC)


 * Ah yes, I understood shortly after posting here that it was describing a clever (or stupid) hack that lets you use Wikipedia itself to sort the wikitext of a table. I've also added a section on "Sorting tables by default" with the content saying "it can't be done", per your suggestion. Shreevatsa (talk) 21:37, 1 August 2009 (UTC)

Clicking the Sort button jumps to top of page
Does anyone know what is going on here? In this article, only the first five columns of the table in section 5 (history) are sortable. The last buttons cause a jump to the start of the page for some strange reason. --KarlFrei (talk) 09:53, 26 June 2009 (UTC)
 * I don't know what the problem with this specific table is, but I noticed the same problem if I don't specify a column entry. See the example below.

sorts:

good code:

does not sort:

bad code (second last line is missing): bamse (talk) 10:58, 26 June 2009 (UTC)
 * Thanks! I have now realized that the problem was due to a cell spanning multiple columns. --KarlFrei (talk) 13:09, 26 June 2009 (UTC)

JavaScript sentence poorly written
As of 26 June 2009 the first sentence under the JavaScript section is confusing and doesn't appear to be proper English:

"'The JavaScript code wikibits.js has on each site a copy at /skins-1.5/common/wikibits.js, on this site http://en.wikipedia.org/skins-1.5/common/wikibits.js.'" Unjedai (talk) 14:57, 26 June 2009 (UTC)

I'll try again. What is the above sentence trying to say? What is the point? Is it trying to say that the JavaScript necessary to make table sorting work is installed with MediaWiki 1.9 and above versions in the /skins-1.5/common/wikibits.js directory, and that, for example on Wikipedia the URL for that is http://en.wikipedia.org/skins-1.5/common/wikibits.js? Unjedai (talk) 18:25, 23 September 2009 (UTC)


 * I think that's what it's trying to say, yes. Don't see why it's necessary to say that, though. Shreevatsa (talk) 19:33, 23 September 2009 (UTC)


 * I think it's helpful because for some reason sorting isn't working on my wikis and this may help me know where to look for the problem. But I propose rewording it like this: "The JavaScript necessary to make table sorting work is at /skins-1.5/common/wikibits.js for each site. For example, on Wikipedia the URL is /skins-1.5/common/wikibits.js." Unjedai (talk) 15:33, 8 October 2009 (UTC)

Why is sort type not specified in column header?
It would be much less error prone to specify the sort type in the column header itself (similar to class="unsortable"). I propose class="date|numeric|currency|string|unsortable" in the header template to override determining a sort order by parsing the first cell in the table. This would fix many, many sorting bugs due to some rows containing bad data, such as "", "123±5" or "15—17" not being seen as numeric. --IanOsgood (talk) 18:44, 5 July 2009 (UTC)
 * I see someone has already proposed a similar patch (class="sort-*"). I heartily approve. What will it take to get it into mainline? --IanOsgood (talk) 18:57, 5 July 2009 (UTC)

Why....?
Why, on New Zealand firefighter referendum, 1995, does it sort some percentages funnily, particularly in the 'no' column? If someone could fix this or tell me how to fix it, I would be very appreciative.Adabow (talk) 01:50, 17 July 2009 (UTC)

Need help with numerical sorting
I want to sort for the "Size column, but can't get it to happen. Here's my table:

Section break
Please help! Curly Turkey (gobble) 08:00, 10 September 2013 (UTC)

Single column
I isolated just that column, and now it is sortable. So something from the rest of the table is preventing the sorting of that column. That is as far as I have it got it so far.

See:
 * User:Timeshifter/Sandbox40

Please do not edit my sandboxes. Anybody can create their own. --Timeshifter (talk) 15:37, 10 September 2013 (UTC)

Rowspan and colspan in table headers
See this section higher up:
 * Help talk:Sorting

When I remove rowspan and colspan from the headers the problem is solved. See:
 * User:Timeshifter/Sandbox41

Please do not edit my sandboxes. Anybody can create their own. --Timeshifter (talk) 15:37, 10 September 2013 (UTC)
 * I think I've got the hang of this now. The software gets terribly confused when column headings contain rowspans; it loses track of which heading goes with which column. I copied your table and fixed the problem in my sandbox User:John of Reading/X1 ([//en.wikipedia.org/w/index.php?title=User:John_of_Reading/X1&oldid=572365014 Permanent link]). I eliminated the "rowspans" from the column headings by splitting those cells in half, and then hiding the join by setting the border-bottom/border-top attributes to make the unwanted line go away.

{| class="wikitable sortable plainrowheaders" ! scope="col" colspan="2"|Name ! style="border-bottom:none" | ! style="border-bottom:none" | Size ! style="border-bottom:none" | ! scope="col"|English ! scope="col"|Japanese ! scope="col" style="border-top:none"|Established ! scope="col" style="border-top:none" data-sort-type="number"|ha (acres) ! scope="col" style="border-top:none"|Prefecture(s)
 * + Japanese serow conservation areas
 * -- John of Reading (talk) 16:45, 10 September 2013 (UTC)
 * It is a bug in the implementation of the feature above that you link to. Now sorting works for headers under colspans, but it breaks on columns that follow such a colspan :( It's known as issue 53211. When I have time, i'll look at it, but currently it's broken yes. It would help if more people were willing to work on this code. Currently it's just me and MatmaRex doing some maintenance, but it doesn't seem if anyone really cares about working on this feature, which is a shame, because it can be quite powerful. —Th e DJ (talk • contribs) 16:50, 10 September 2013 (UTC)
 * It would also help if people would just live with the restrictions. The table above can easily be modified not to use any colspan/rowspan ("Name" is unnecessary). -- Michael Bednarek (talk) 02:35, 11 September 2013 (UTC)

Sorting not working with complex headers
Could someone please help fix a sorting issue on List of A-League honours. When you click to sort a table, it sorts the one on the left rather than the one you clicked and I'm not sure how to fix the issue. Help would be much appreciated. --2nyte (talk) 05:57, 18 April 2013 (UTC)
 * same as the thread above, [//en.wikipedia.org/w/index.php?title=List_of_A-League_honours&diff=551178836&oldid=550929605 fixed here]. Frietjes (talk) 19:45, 19 April 2013 (UTC)


 * Thanks. I could not figure out either fix. I still do not understand what is going on. Is this explained in Help:Sorting? If it is, I couldn't understand it. Could you write up some info here, or in Help:Sorting? Others can also try to clarify things more simply in Help:Sorting.


 * It is common to have sorting problems when there are multi-row headers. I gave up trying to combine sorting with multi-level, multi-row headers. --Timeshifter (talk) 05:03, 20 April 2013 (UTC)
 * I believe this issue is that row of cells with the sort keys cannot have rowspans. So, the fix is to split the ones with rowspans into two rows, but then make them appear as if they are joined cells by removing the border between the cells.  Thanks! Plastikspork (talk) 23:24, 21 April 2013 (UTC)

(unindent). I think I figured it out a little bit. Help:Sorting needs a separate section just for getting sorting to work with complex headers. There is no such section now. Maybe I will get around to it someday.

Plastikspork, I think this is what you are talking about:

The key is that there are no rowspans used in the headers. This is done by giving the appearance of rowspan without actually using rowspan in the headers. CSS styling is used to hide the border between 2 cells, and thus make them look like one cell spanning 2 rows. CSS styling: --Timeshifter (talk) 09:08, 25 April 2013 (UTC)
 *  style="border-bottom:none" 
 *  style="border-top:none" 
 * Yeah this is a known issue indeed. It shouldn't be too difficult to solve, I now pointed out in the ticket where in the source code this needs to be fixed. If I can find the time I might fix it myself. —Th e DJ (talk • contribs) 09:33, 25 April 2013 (UTC)
 * Hmmm. Did not know it was in Bugzilla. Has sorting worked in the past when there were rowspans in the headers? --Timeshifter (talk) 10:27, 25 April 2013 (UTC)
 * Perhaps with the old version of the sorter before 1.19. That one had plenty of other problems though. —Th e DJ (talk • contribs) 10:54, 25 April 2013 (UTC)
 * I submitted a changeset that implements this. Let's hope it doesn't break anything this time :D —Th e DJ (talk • contribs) 08:06, 26 April 2013 (UTC)
 * Great! Thanks. What is the status on that? --Timeshifter (talk) 20:53, 2 May 2013 (UTC)

(unindent). Here is the same chart, but using rowspan too: {|

When the 38911 fix is implemented the above chart will sort correctly. --Timeshifter (talk) 19:53, 12 June 2013 (UTC)
 * }

This second example (by using rowspan) does not work correctly when there is one or more columns right to the row/colspan group of columns: {|

In Firefox 24.0, the first column "name" runs properly; "data" sorts "more data"; "more data" sorts "Another column"; and "Another column" sorts "data". Sorry but 38911 hasn't be fixed very well. –p joe f (talk • contribs) 15:55, 5 October 2013 (UTC)
 * }


 * I mentioned the problem in 38911 and linked to this talk page. --Timeshifter (talk) 15:09, 7 October 2013 (UTC)
 * Thank you, Timeshifter. I will take a look at this page then. –p joe f (talk • contribs) 19:09, 8 October 2013 (UTC)

Sortable table
When I use the Sortable table on the Welsh Wikipedia, the English title "Sortable table" hovers heavily above it. This is unnecessary, even in English imho; certainly unnecessary in every other language. How do I get rid of it please? For example: A list of Welsh Literary Books published since 1996. - Llywelyn2000 (talk) 23:16, 16 October 2013 (UTC)
 * you [//cy.wikipedia.org/w/index.php?title=Rhestr_llyfrau_Cymraeg_llenyddol&diff=1568912&oldid=1568910 remove it]? Frietjes (talk) 23:55, 16 October 2013 (UTC)
 * No sooner said than done! Many thanks! - BOT-Twm Crys (talk) 08:04, 17 October 2013 (UTC)

Adding mid-stream or floating headers
It would be nice to have some way, for long tables with several columns, to repeat the header, or have it floating when you scroll down, or *something*, without having to disable sortability or end up with all the spare headers bunched together if you sort. Is there any way to do this?

Several basic approaches I can imagine:

1. have a way to basically say "ignore this line when you're sorting, this is row 20 regardless of what goes on around it" or the like

2. have a way to make a table automatically spit out a "header" line every 20 rows (or whatever)

3. use framing or the like to have a "floating" header line that stays visible when you scroll past the header

This is particularly a problem for the "vampire traits" page. It has *huge* tables, mostly consisting of columns with entries like "yes", "fatal", "no", and the like. Tamtrible (talk) 00:52, 11 July 2013 (UTC)
 * Yes, this would be nice, and we have a ticket for adding 'floating' headers. I actually tried it a couple of times already, but there are some difficulties in implementing it. (Having to do with cloning the headers and events, when we use collapsible or sortable tables as well as the fact that we can and do have very complex spanning of columns and rows in headers). The other solutions, are in my opinion hacks, which we shouldn't implement. —Th e DJ (talk • contribs) 08:42, 11 July 2013 (UTC)


 * Given the problems you're having doing this "right", this may be a "the perfect is the enemy of the good" situation. At least as an interim measure until floating headers are sorted out, having some way to repeat headers would be helpful.  And, independent of the header issue, I can see some utility to having the ability to make lines that are ignored by sorting--for example, adding little markers to a long table to indicate where the middle of the table is, so it's easier to tell what entries are above and below average.  Tamtrible (talk) 22:22, 14 July 2013 (UTC)


 * Any progress? she asks hopefully Tamtrible (talk) 20:42, 18 November 2013 (UTC)

Sorting problem with complex table caption
I've been working for more than an hour with edit previews to make the table at Template:Boxer Rebellion sortable, but it's not working! The problem seems to come from the complex table caption, which contains the table title, an image file, and an image caption. Three different things happen depending on what code I use to introduce the table caption:
 * 1) When I use the recommended "|+" code, some of the caption displays outside the table and the border for the caption cell disappears.
 * 2) When I use a regular "|" for the caption cell, the caption displays fine, but the table becomes unsortable even if it has "class=wikitable sortable" on top.
 * 3) Finally when I use "!" as code, the table becomes sortable again, but the caption cell displays with the same background color as cell headers and with bold fonts on everything.

Here's my table for the third example:

I'm not competent enough with tables to figure this out, so I'd be very grateful for your help! Cheers, Madalibi (talk) 12:11, 21 February 2014 (UTC)
 * This is not directly helpful, but allow me to ask: why? Why is it necessary to have a table of 8 rows sortable? I suggest that the average reader is well capable of judging the relative strengths of the alliance's members just by looking at the table. -- Michael Bednarek (talk) 13:17, 21 February 2014 (UTC)
 * Good point, especially since the number of ships is usually proportional to the number of troops, so that the order of countries is always about the same. But having spent so much time on this (actually much more than an hour), I'd like to know the technical solution so that I can both format this table properly and solve this kind problem in other, more complex tables in the future. Madalibi (talk) 14:07, 21 February 2014 (UTC)

Table with more complex headers
See section higher up:. I copied this table from that section so as to focus discussion.

{|


 * }

I read that there is a patch being reviewed that may fix this. See comment 8 in 38911: "Timeshifter, patch for bug 53211 – https://gerrit.wikimedia.org/r/#/c/98250/ – should fix that as well."

So when this table works, that means the patch code has been installed. --Timeshifter (talk) 08:07, 9 December 2013 (UTC)


 * Patch has been installed. I see that this table is now sorting correctly. See comment 9 in 38911: "It has been merged now, at last." --Timeshifter (talk) 14:45, 9 April 2014 (UTC)

class=sortkey
I use  (in a span). Works good for me. Shouldn't it be in the doc, or is it deprecated? -DePiep (talk) 19:19, 18 April 2014 (UTC)

Can't get simple table to sort
At List of largest lakes and seas in the Solar System, I specified that the columns were to sort by "number", and set the data-sort-value for individual cells (with and without commas in the values), but I can't get the table to sort numerically. What am I doing wrong? — kwami (talk) 19:24, 24 April 2014 (UTC)
 * Now that the  parameter, it works for me. -- Michael Bednarek (talk) 03:39, 25 April 2014 (UTC)
 * Thanks! I never would have thought of that.  — kwami (talk) 05:06, 25 April 2014 (UTC)

Chinese language names sorting
Can anyone direct me to an explanation of the Chinese language name sorting defaults used in 'wikitable sortable'? This is in connection with the article List of power stations in China (for example Coal). Thank you.  Klein zach  07:33, 8 May 2014 (UTC)

Weird purple "unsortable" table for sortable
Can someone please check List of Indian states and territories by highest point.

Am I the only one seeing the first table as an unsortable and purple colored? The second table is working fine for me.

If others are not facing this problem, any idea why I could be having it?

Thanks. Ashinpt (talk) 09:34, 19 June 2014 (UTC)
 * Fixed - someone had damaged the sidebar, Lists of states and territories of India. Articles using this sidebar may need a purge to have their formatting repaired. -- John of Reading (talk) 09:52, 19 June 2014 (UTC)
 * Gee... Thanks for your help, mate. Ashinpt (talk) 10:27, 19 June 2014 (UTC)

Table not sorting at List of awards and nominations received by Game of Thrones
When I click one of the headers, the year column breaks into individual lines but nothing else happens. I'm on Chrome. Darkwarriorblake / SEXY ACTION TALK PAGE! 20:42, 10 July 2014 (UTC)


 * Sorting is working for me in Firefox. --Timeshifter (talk) 14:41, 11 July 2014 (UTC)
 * Doesn't work for me in Chrome, Firefox or IE. Darkwarriorblake / SEXY ACTION TALK PAGE! 20:41, 11 July 2014 (UTC)


 * I have the same behavior as Darkwarriorblake on Firefox and Chrome (on Linux) whether sorting by Category, Recipient, or Award.  Almost certainly the problem is the    to construct the table.  —EncMstr (talk) 22:36, 11 July 2014 (UTC)

Sorting is working for me in Firefox and Internet Explorer (I don't have Chrome) in this revision of the table:
 * https://en.wikipedia.org/w/index.php?title=List_of_awards_and_nominations_received_by_Game_of_Thrones&oldid=616477949

Let us check the easy stuff first. Do the previous posters have problems with complex headers? From Help:Sorting: Section titled: "Tables with complex headers":
 * Help:Sorting

Supposedly, people should no longer have a problem with this table below. Sorting is working for me. Is it working for you?

If that table sorts for you, then the next step is figuring out what is happening farther down in the table in question. I am just trying to get a base line of what is working for all of us. --Timeshifter (talk) 13:52, 12 July 2014 (UTC)


 * Checking more revisions I see that sorting works for me (Firefox and Explorer) in this later revision:
 * https://en.wikipedia.org/w/index.php?title=List_of_awards_and_nominations_received_by_Game_of_Thrones&oldid=616558443


 * The very next revision does not have sorting working for me:
 * https://en.wikipedia.org/w/index.php?title=List_of_awards_and_nominations_received_by_Game_of_Thrones&oldid=616572153


 * Here is the diff between those 2 revisions:
 * https://en.wikipedia.org/w/index.php?title=List_of_awards_and_nominations_received_by_Game_of_Thrones&diff=616572153&oldid=616558443
 * --Timeshifter (talk) 14:04, 12 July 2014 (UTC)


 * I think the simple solution is to remove all the rowspans in the body of the table. See new section in Help:Sorting titled "Avoid rowspan in body of table". --Timeshifter (talk) 16:34, 12 July 2014 (UTC)
 * Thanks for the feedback, it was a miscounted number of rows, should've been "49" and not "50", it now appears to be working for me. I get what you're saying regarding rowspan but I think as a default, using rowspan makes the table look much more presentable, while sorting adds those individual fields in without an editor having to provide the text themselves in the code to present 2 dozen "66th Annual Emmy" fields. Darkwarriorblake / SEXY ACTION TALK PAGE! 18:39, 12 July 2014 (UTC)
 * Yes, but once it's done, it's done. No more stress and pain for various editors fixing this stuff over and over. Plus it allows you to better use an easy online table editor such as this one:
 * http://wikitable.eu5.org
 * Try it and see what I mean. Without rowspans it is easier to change the underlying framework of a table, and move stuff around. Once the wikitext framework is simpler, the online table editor is simpler too. Because you don't have to muck around in the wikitext frame as much. --Timeshifter (talk) 15:07, 13 July 2014 (UTC)

Which algorithm is used?
Which algorithm is used by the Wikimedia software to sort sortable tables? This question seems to be not of interest concerning practical uses, but it determines wether the sort is stable (when I have understood the term "stability" in algorithm theory correctly), and finally, it influences the user experience (a stable sorting algorithm would allow him to easily sort by various criteria simultaneously). — Preceding unsigned comment added by 2003:45:CB20:E622:3D7B:4EA5:BF9B:189E (talk) 19:47, 23 September 2014 (UTC)


 * You might also check out these pages, mw:Help:Sorting, m:Help:Sorting, and their talk pages. --Timeshifter (talk) 00:10, 24 September 2014 (UTC)
 * merge sort? Frietjes (talk) 00:14, 24 September 2014 (UTC)

Date sort apparently only working in Chrome
I have what I think is a fairly simple sortable table, Table of models with four sortable columns, two number and two date. All work fine in Chrome v37 on both Win7 (64 bit) and WinXP but the date columns don't sort in IE8/XP, IE11/Win7 or Firefox 31. The first column, Date, sorts fine in all systems. I'm thinking about going to data-sort-type="number" and using embedded sort values as a work around. Anyone else have the same problem? Any help would be appreciated? Tom94022 (talk) 21:51, 9 October 2014 (UTC)


 * Please have a look here: Help:Sorting --Timeshifter (talk) 07:02, 10 October 2014 (UTC)


 * I actually developed the Table of models based upon Help:Sorting using data-sort-type="isoDate" for two columns. FWIW the three data-sort-type columns in Help:Sorting all fail in the same way on my FF31/XP and IE11/Win7 systems, the directional icon at the top of the column changes state but there is no sorting. The number type sorts work.  So it is either a setup problem in my two systems or a bug in the code.  Since the number type seems to work I guess I will switch to that type of sort and use values to force sort order.  Any idea what may be wrong - Java installations perhaps?  Any one else see this problem?  Tom94022 (talk) 17:39, 10 October 2014 (UTC)
 * I converted one column to number sort and it worked in both FF and IE11 Tom94022 (talk) 21:19, 10 October 2014 (UTC)
 * I think you misread Help:Sorting. I clarified the intro to that section just now by bolding the part about "does not work". I only remember this stuff when I come back here and read what I wrote long ago. :) I only wrote some of the help page. So I am not really an expert. And I did not develop the code. You said that the number type sorts work. Number sorting has many rules. You will have to read the relevant sections carefully, and experiment. Let us know what you discover, and what needs to be changed in the help page. Please link to specific revisions in stuff you are explaining so that we are talking about the same thing. --Timeshifter (talk) 02:11, 11 October 2014 (UTC)
 * I guess I was fooled by the working example into misreading the note, so I rewrote it to make it clear what to avoid. Hope you approve, rewrite if you wish.  As far as using   to sort dates, I just put   into each cell and it is working so far.  Thanks for supporting the article.  Tom94022 (talk) 06:30, 11 October 2014 (UTC)
 * Thanks for clarifying the help page. --Timeshifter (talk) 07:23, 11 October 2014 (UTC)

A correct table forbidden?
The help page now says: "Avoid rowspan in body of table". I find this a bit too strong. As we know, these days the rowspan is undone when a reader clicks a sortbutton (the table is turned into single-rows only with repeated cellcontent: all correct).

Indeed, adding rowspan is a complicating, but I don't see why it should be "avoided" (no exception mentioned!).

First of all, adding rowspan can be desirable before any sorting comes in play. It is a basic table feature. Second, using rowspan and sorting correctly, why not? The "avoid" 'advice' (actually to be read as a MOS guideline) does not prove that is causes errors or a wrong reader experience.

I suggest the wording is changed. There could be a warning in there, but not a scare. And to be clear, I am not planning to undo the pages where I applied rowspan in a sortable. -DePiep (talk) 08:34, 17 October 2014 (UTC)


 * I changed the wording so that it is less strong. Now the heading says "Difficulty of rowspan in body of table". --Timeshifter (talk) 05:29, 19 October 2014 (UTC)
 * OK, but the wording is a bit off too. For example, the second paragraph is about writing the correct table, which could be indeed, but that is independent of the sort option. I prefer reducing the non-sort text, and remove all scaring stuff. That is not help. -DePiep (talk)


 * I don't understand. What exactly is incorrect? --Timeshifter (talk) 21:39, 21 October 2014 (UTC)

Heading background color on sortable tables
I'm building the List of mammals of Oregon which currently has sortable tables with a background color, but it does not have the arrows pointing up and down in the column header, like most of the other sortable tables do.

Header with color background example:

Header with arrow but no color example: Is there a way to have both the arrows and the background color? &mdash; Gaff  ταλκ  21:29, 25 October 2014 (UTC)

I did not find a solution either. I sometimes use this compromise:


 * Also helps me out when column titles are crammed and can use extra space. Separating the sortbuttons and text always looks nicer to me. -DePiep (talk) 01:32, 26 October 2014 (UTC)
 * Does not show well in mobile view (no sort buttons, so makes an empty row). -DePiep (talk) 01:32, 26 October 2014 (UTC)

Thank you. Somebody at the Help Desk showed me a solution and I came up with this: &mdash; Gaff  ταλκ  01:46, 26 October 2014 (UTC)


 * So one writes:
 * !style="background-color:#FFDEAD;"
 * not
 * !style="background:#FFDEAD;"
 * Glad to learn this. -DePiep (talk) 02:22, 26 October 2014 (UTC)


 * I clarified a heading in Help:Sorting concerning combining header styling and sorting. --Timeshifter (talk) 03:11, 26 October 2014 (UTC)


 * I added styling workaround 2 to Help:Sorting in the section concerning combining header styling and sorting. The second row of headers below the main row of headers is useful when the width of the monitor is inadequate for the number of columns. --Timeshifter (talk) 06:45, 27 October 2014 (UTC)


 * Why call it a workaround? Is it not a correct difference within css we usually don't notice? Or, if it is a workaround in wiki software (as the bug indicates), why bother the editor with it as an issue? Maybe a subheader like "background colors in sortable headers" would help-page visitors more.
 * I'll apply this to my earlier example (split sort buttons row), just to check myself. Looks OK.
 * Example #5 (is #3 adjusted):
 * {| class="sortable wikitable" style="margin:1em auto; text-align:center;"

!style="background:navajowhite" class="unsortable"|Name !style=background:navajowhite|Species Authority !style=background:navajowhite|Family !style=background:navajowhite|State distribution and notes !style=background:navajowhite|Red List ! style="line-height:80%; background-color:#FFDEAD;"| !style="background-color:#FFDEAD;"| !style="background-color:#FFDEAD;"| !style="background-color:#FFDEAD;" class="unsortable"| !style="background-color:#FFDEAD;"| (Kerr, 1792)
 * Virginia opossum
 * Didelphis virginiana
 * Didelphis virginiana
 * Didelphidae
 * introduced early 1900s; etc.
 * 7 Fl mammals lc.svg
 * }
 * -DePiep (talk) 09:21, 27 October 2014 (UTC)
 * -DePiep (talk) 09:21, 27 October 2014 (UTC)


 * Yes, "Background colors in sortable headers" is a clearer heading for that section on the help page. I moved the other info to a new section called "Putting sorting buttons below header text". --Timeshifter (talk) 06:52, 29 October 2014 (UTC)

Colspan still unsortable?
Hello,

I was trying (on the French Wikipedia) to create sortable tables with both "rowspan" and "colspan" attributes. As it wasn't working I tried tables with "rowspan" or "colspan" only. The first ones are working well, but none of the tables with "colspan" do. After some research (including information on this page) I found that "colspan" was still preventing sortable tables to work well. I'd like to know if there has been any improvement regarding this issue lately, and if not why this bug page was closed in Bugzilla while "colspan" is still breaking table sorting.

Encolpe (talk) 08:15, 14 October 2014 (UTC)
 * Can you link to revisions of the page with and without the problems? --Timeshifter (talk) 15:22, 15 October 2014 (UTC)
 * Hello Timeshifter,
 * For example, the first two tables on Prix Eisner. Titles ("titres") and artists ("dessinateur") sort well, but then it's chaos.
 * Thanks Encolpe (talk) 20:00, 15 October 2014 (UTC)
 * Looks like 8028 needs to be reopened. :) The sorting code has gone through a lot of changes over the years. Please leave a message in that bugzilla thread. I don't have time. And it sounds like you have some experience trying out "rowspan" or "colspan" in various tables. --Timeshifter (talk) 02:24, 16 October 2014 (UTC)
 * Yes, I love to do nice tables lol
 * I'll try to have the bug report reopened but I'm afraid I won't be able to do anything more to help solving the problem.
 * Thank you for your help anyway! Encolpe (talk) 09:19, 16 October 2014 (UTC)

Hi! I created a new Bigzilla Report, still unsuccessfully so far ;) Encolpe (talk) 08:02, 2 November 2014 (UTC)

Tables with complex datarows
DePiep. You can reword stuff, but not wholesale remove whole sections as you did here. Not without discussion. We already changed the title as you requested. --Timeshifter (talk) 13:04, 10 November 2014 (UTC)


 * I think I see what you are trying to do, DePiep. I reworded the section and incorporated most of your wording. I shortened it and removed more of the warning tone. People now have more freedom to choose. --Timeshifter (talk) 13:26, 10 November 2014 (UTC)
 * Wholesale changes can be an improvement too. Being wholesale is not a reason to dismiss it.
 * Now, the section was not written as a help section at all. It kept repeating possible problems with rowspans and say "don't do it". That is not the topic of this page. Just note that these problems mainly exist for rowspan alone, with or without sorting. Also, the text was not a "help". And the advice to avoid rowspans always plus when sorting may be outdated because table sorting has improved enough. In short: if you build a good rowspanned table, you can add sorting.


 * What I wrote, and what I or any other editor expects to find here, is: if you have you rowsort OK, you can set it sortable. Not more complicated. (Must say that HELP:TABLE is not as complete on rowsort as I'd expect). Now I'll go read your edit. -DePiep (talk) 14:07, 10 November 2014 (UTC)
 * I removed again your copmplaints about rowspan being difficult. That is not the topic. And it is not even true. This is helptext: If you need rowspan, use rowspan. You can even sort it. -DePiep (talk) 14:12, 10 November 2014 (UTC)

Cleanup
I am performing some technical cleanup. Some issues: --  Gadget850talk 13:21, 10 November 2014 (UTC)
 * Auto-ranking or adding a row numbering column (1,2,3) next to a table
 * Has links to user subpages
 * Default data type of a column
 * Contains: "proposed internationalisation: in German etc., treat comma as a decimal point" which makes no sense to me in its context


 * I don't know anything about the German stuff. As for the linking to user pages, if it was prohibited on help pages the bots would have removed it long ago. They do so on article pages. I link to user sandbox pages from many talk pages. People use external links in the body of help pages, and not in reference format. Can help pages have subpages? If so, the row number columns can be moved there. --Timeshifter (talk) 13:33, 10 November 2014 (UTC)
 * Yes, subpages are enabled in the Help subspace. I don't know that there is a specific prohibition, but it is not a good idea. --  Gadget850talk 14:24, 10 November 2014 (UTC)

Question on sorting
In a sortable table like the above one, when you click on any column's header to sort by that column's contents the contents of the cells of the first column will be split and doubled. Is there any way to code such a table that it only splits if you sort on the second column and that if you sort back on the first column after having sorted on the second column the cells that were split in two are merged again to their original state? Tvx1 02:20, 1 March 2015 (UTC)
 * I don't know of any way to do that. Maybe someone else does. --Timeshifter (talk) 03:54, 2 March 2015 (UTC)
 * a) If a feature (row splitting in a sortable table) doesn't work as expected, don't use it; b) F5 (page refresh). -- Michael Bednarek (talk) 07:36, 2 March 2015 (UTC)
 * a) I know that. I have come here to ask whether there is a provision I'm not yet aware of that does allow the feature to work as intended. b) mobile devices don't have an "F5". Tvx1 19:23, 2 March 2015 (UTC)
 * None of the 3 browsers on my mobile phone allow any sorting of tables in Wikipedia pages at all, but they all have the Circle-redo.svg "Redo" function. -- Michael Bednarek (talk) 04:53, 3 March 2015 (UTC)

Similar problem on sorting
I have a similar problem as the one inquired above. When I sort that table in my Sandbox, Moszkowski's Op. 3 for instance, appears with Title, Opus number and Year displayed in four lines, not in one, the way it should be. The same happens with every composition containing more than one movement or key. How could I solve this problem and display Title, Opus and Year without doubling ? Krenakarore TK 23:05, 23 March 2015 (UTC)
 * Link? --Timeshifter (talk) 02:09, 24 March 2015 (UTC)
 * User:Krenakarore/sandbox Krenakarore  TK 02:57, 24 March 2015 (UTC)
 * You might want to divide up those tables to more sandboxes. There are 2 long tables on one sandbox page. I am up to 51 sandboxes on Wikipedia: User:Timeshifter/Sandbox51. Once I link to a sandbox, I don't change its purpose. That way others can follow along later concerning past discussions. I just create more sandboxes.
 * See Help:Sorting. It says "Note that, after sorting, the rowspanning cells are cut into rows and their content is repeated." As far as I know there is no way to return to the old format except by reloading the page.
 * Are the columns sorting correctly? If not, then the problem is often due to not having the correct rowspan numbers. That is the problem I helped someone solve with User:Timeshifter/Sandbox51. I don't want to do that again though. Takes a long time to count the rows for each rowspan. That is why I think it can be better to avoid rowspans. Unless you inform editors how important it is count the rows, and to test sorting after any changes in the table. --Timeshifter (talk) 23:37, 24 March 2015 (UTC)
 * I thought it might have something to do with data-sort-values, text, numeric... something like that. For me, there should be a way to fix the rows and keep 'em fixed while in sorting mode. Op. 6 for instance, it should read Fantasie-Impromptu once, not three times. Krenakarore  TK 02:14, 27 March 2015 (UTC)

Nonsensical sorting by year
When you sort this table by year http://en.wikipedia.org/wiki/United_Nations_list_of_Non-Self-Governing_Territories#Change_in_status_by_administrating_state the order is complete nonsense! There isn't any logic to it! WTF? Oh and yet the sorting works perfectly right in the editing preview, just not when it's saved. Still can't sort properly. In 2015... --178.0.100.7 (talk) 11:45, 13 April 2015 (UTC)


 * My first impression is that population column has some cells that are blank. Not sure until I read Help:Sorting, but I think that means you will need to add data-sort-type="number" to that column head. "Year of removal" is a date column. Good luck with that. :) Lots to read in Help:Sorting on date columns. I may not have time to help much. You gotta read the manual. ;) That should get you started on your reading. --Timeshifter (talk) 17:31, 13 April 2015 (UTC)

Default numerical sorting
Can anyone explain to a markup-challenged individual (me) why numerical list/columns default to sorting by the first digit, rather than by whole numbers? I can't think of many situations in which such a default is useful. Is this, perhaps, an unintended side-effect of alphabetical sorting?

There are quite a few broken tables out there as a result, and I (for one) find the instructions for using data-sort-type="number" difficult to follow, to say the least.

I don't know how difficult to implement this would be, but: it would save a lot of work if the in-built default sorting of digits worked differently to that of alphabetical characters. Grant &#124;  Talk  05:24, 1 June 2015 (UTC)
 * Please just link to the table that you need help with —Th e DJ (talk • contribs) 07:49, 1 June 2015 (UTC)
 * I think the default is alphabetical unless a whole column only has numbers. But there are many exceptions. Empty cells for example. See the details listed in the help page. It took me awhile to figure out a few of the rules. I am not the programmer though. And a computer program has to look at a column and decide if it should be sorted alphabetically or numerically. Not an easy task, since any text in a cell means what?. Text after the number for example. :) Do you have a specific table in mind? --Timeshifter (talk) 12:42, 2 June 2015 (UTC)

Targets table refusing to sort
Could someone possibly have a look at what's gone wrong with the tables here (under Target seats)? The final four columns to the right sort fine in preview mode but they refuse to sort properly on the article itself. — Nizolan  (talk) 23:13, 11 May 2015 (UTC)


 * User:Nizolan. Here is what I came up with as a solution for the top table in that section:

Conservative Party

I removed all the rowspans and colspans. I cleaned the table up further by removing all the sort templates. They were unnecessary. All the columns sort correctly. --Timeshifter (talk) 22:42, 15 May 2015 (UTC)


 * I went ahead and added the table to the article, and a note about it on the article talk page. --Timeshifter (talk) 16:34, 23 May 2015 (UTC)
 * A text editor's find-and-replace command speeds up fixing tables. Even Notepad (basic text editor that comes with Windows) will work. The replace command in the edit menu of Notepad. --Timeshifter (talk) 15:04, 7 June 2015 (UTC)

Row filtering & Multiple sort fields
Is there any way to add filters on row headers to only show some of the rows in a given table. I understand that this is not trivial as it requires to adapt to each data types and to provide a minimal boolean function, but that would be a (very) nice addition to sortable tables. Along the same way it would be nice to allow sorting on multiple columns (A then B, then C). knd (talk) 09:10, 12 June 2015 (UTC)


 * Can you explain further? I do not understand what you are trying to do. Can you point to tables on the web that illustrate what you are trying to do? --Timeshifter (talk) 20:08, 14 June 2015 (UTC)

Numerical sorting question
I am currently working on this table. After reading the advice in this page, my understanding is that it is impossible to have the cells containing numbers sorted first, with blank/NA/- cells following afterwards. Is that correct? AtHomeIn神戸 (talk) 05:35, 23 July 2015 (UTC) Updated link since page has been moved. AtHomeIn神戸 (talk) 02:04, 2 September 2015 (UTC)