Help talk:Sortable tables/Archive 4

Sorting issue
I have a problem sorting column called "ISO performance" at Comparison of digital single-lens reflex cameras. I tried to put space between the value and ref tag, but that did not help.--Kozuch (talk) 20:56, 29 July 2010 (UTC)

Striping issue
Does striping actually work? Is there an additional class you have to define for the table? I have tr.odd and tr.even styles set up in Mediawiki:Common.css however it doesn't seem to do anything. Also, I can't seem to find any tables that use striping to look at as an example. --Celebane (talk) 15:16, 11 August 2010 (UTC)
 * I found my problem. You have to set var ts_alternate_row_colors = true in wikibits.js.  It is false by default. --Celebane (talk) 15:46, 11 August 2010 (UTC)

Lexical order (Greek)
When I sort by the second column (the Greek names) in Lefktro, Agios Nikonos comes before Agios Nikolaos (but Omicron # Omega). This sorting is strange to me, because Άγιος Νικ ό λαος should rank before Άγιος Νίκ ω νος (in the Greek alphabet ο Omicron < ω Omega) - or is the Iota's diagraph (ι vs. ί after Ν) responsible for the difference? Alfie ↑↓ © 16:08, 21 September 2010 (UTC)
 * Edit: Copypasted a short example:


 * It is probably the diacritic, and the fact that we don't sort lexically. We sort probably on the unicode index value of characters. —Th e DJ (talk • contribs) 14:00, 22 September 2010 (UTC)
 * Oh yes. :-( The Iota without the Tonos is H0359 (D953) and the one with is H03AF (D943), therefore ί < ι. Bad luck. Alfie  ↑↓ © 14:35, 22 September 2010 (UTC)
 * Addendum: in the German wiki I found a hint. “Special case #3: Case-Folding maps iota-subscript (U+0345 (ͅ) COMBINING GREEK YPOGEGRAMMENI) to an iota, due to the special behavior of iota-subscript, while the UCA treats iota-subscript as a regular combining mark (secondary ignorable).”. Alfie  ↑↓ © 15:20, 22 September 2010 (UTC)
 * For the archive: Solved by help of de-WP. Template does the job.  Alfie  ↑↓ © 17:44, 22 September 2010 (UTC)

Client side JAVA?
Nice that "client side java", but the mentioned Java looks quite mediawiki specific. Just imported the table into another mediawiki site and it works, but probably only because it is in the memory of my computer? Do I have to download that specific java or link to form my mediawiki site to get it work? Thanks, 190.212.246.246 (talk) 08:46, 27 September 2010 (UTC)

more sortable data in one cell
Sometimes I need several data into one field, separated by a comma or so. For example "works with" =>Adrian, Ronald, Jack. Now if I like to sort on "works with", I get it sorted on Adrian, but on Ronald and Jack nothing shows up... Actually I like the row several times here, but only when sorting on a column that can have more options at the same time. 190.212.246.246 (talk) 08:57, 27 September 2010 (UTC)

Expandable fields
Like to have fixed field-width and hoover over -or similar tooltip- to show all text that is in that field. I have no idea if this is possible at present with mediawiki? 190.212.246.246 (talk) 08:57, 27 September 2010 (UTC)

Lexical order (Greek) (again)
Copied from Help_desk On List of fraternities and sororities in the Philippines, there is a sortable table in the section on General Fraternities and sororities. The first column is Greek Name, which for most of the groups is two, three or four greek letters. If Alphabetized on this column, first come the ones with no Greek Name, then those where the first letter is in fact a Latin Alphabetic Character. After that, it alphabetizes by the Greek Letter itself, Alpha, Beta, Gamma, etc. However even there it is screwy as it alphabetizes in order (at one point): ΑΣ, then ΑΩΒ, then, ΑΦΕ, then ΑΣΕ, and then ΑΦΙΣ. Are there multiple Unicode characters that all look like a single greek letter (say sigma) which could have been copied in to different places that are fouling up the Alphabetical order? I can go through and redo all of them from the character subset area on the edit screen, but I'd like to understand the issue first.Naraht (talk) 15:24, 7 October 2010 (UTC)
 * For me it sorts ΑΣ < ΑΣΕ < ΑΦΕ < ΑΦΙΣ < ΑΩΒ, which looks correct. It may be a browser issue.—Emil J. 15:42, 7 October 2010 (UTC)
 * I switched to IE8 (the first time I was using Chrome) and got the same order that you do on those five. Thank You, Any idea how to make it so that all browsers do it right?Naraht (talk) 17:29, 7 October 2010 (UTC)

This page is scary
I understand sorting pages is a complex subject, but this page scares the hell out of me. This does not seem to be a newbie help page, but an advanced discussion on the topic. Oh, I am still clueless how to properly sort my table numerically. If somebody could look towards improving it I am sure all newbie editors working with tables will be forever gratefull to you. Yoenit (talk) 22:06, 17 October 2010 (UTC)

Striping
This JS is not enabled on en.Wiki, thus it it not useful help. If this is intended to help those on other wikis, then it should be at Meta. There is some discussion on striping at MediaWiki talk:Common.css, but not relevant to the section on the help page. ---— Gadget850 (Ed)  talk 22:35, 17 October 2010 (UTC)

Sortable by Row
Is it possible to make a table that is sortable by rows instead of columns? I.e. if you click the arrow, the table columns to be sorted based on the selected row instead of vice-versa? --93.141.92.218 (talk) 09:22, 30 October 2010 (UTC)

Sorting Problems
I had converted this table from a standard table to a sortable table. How can I fix it so that it sorta 1-10 instead of 1, 10, 11, 2, 3 etc.? Shootmaster 44 (talk) 22:18, 13 November 2010 (UTC)
 * The "NR" entries force the columns to be sorted alphabetically. You thus have to fake an alphabetic sort key for the numerical entries, the easy way to do that is to use nts.—Emil J. 12:18, 15 November 2010 (UTC)

problems with sorting by dates
I'm using the sortable table class, but am having problems sorting by date. I find the instructions a little unclear; is there any format you can apply to the date so it's not linked but still sorts correctly? Thank you. --CutOffTies (talk) 01:56, 30 November 2010 (UTC)
 * Try using Template:Dtsh.Jason Rees (talk) 02:03, 3 December 2010 (UTC)
 * Thank you!! --CutOffTies (talk) 02:40, 3 December 2010 (UTC)

Explicit sort modes?
Would it be possible to add the ability to override the automatically-selected sort mode? Perhaps the column heading could be given an attribute like sortMode="numeric" that the Javascript could detect and use instead of the auto-detected mode? --Doradus (talk) 15:21, 19 December 2010 (UTC)

Attribute data-sort-value
It seems to me that the HTML attribute  (see mediawiki implementation) makes the hidden sort templates hs and hid obsolete. Many other templates which use, e.g. Sort, Sortname, dts and its many siblings, should be rewritten. If this is not feasible, the use of this attribute should be explained on this help page and in the documentation of those templates, giving guidance in how to avoid the templates in many cases for the benefit of cleaner and faster code. I have successfully used this attribute for the. -- Michael Bednarek (talk) 12:48, 24 February 2011 (UTC)
 * It appears all attributes beginning with "data-*" are currently being stripped by the Wikimedia parser. This means "data-sort-value" does not work here on Wikipedia or any of the other Wikimedia projects. Witness that the example you provided doesn't work, either. - Vague | Rant 16:51, 1 August 2011 (UTC)

Reverse order a table permanently
I'm sure someone has figured out how to do this easily but I'm stumped. Take an article like Italian_Open_(tennis) and the mens singles table. It starts in the year 2011 but at wiki tennis project we want it to start in 1930. If we don't want it sortable but we want it reversed what's the easiest way to do it? If I make the table sortable and then click on year to reverse the order, that's the way I want it to look all the time. Right now I'm copying the wiki table code into MS Word, reversing it year by year by hand, and then pasting it back into the article. If it's 10 items that's no big deal but when I have tennis tournaments that go from 2011 to 1897 that's a ton of time and effort to do. I wish I could make it sortable on wiki, click the year so that it looks the way I want, and then hit edit and have it keep that new order... but wiki doesn't work that way. Has anyone got a better idea for me. Thanks. Fyunck(click) (talk) 09:18, 27 May 2011 (UTC)

[cricobr] The following are a set of steps which could help you achieve what you want. I have not explored the idea fully, or even tested the resulting output, but the steps described below should be enough for you to apply the ideas in your specific case, and for others to apply the ideas in other contexts. I'm certain none of this is new, but it seems useful and powerful enough to be worth a try in yours and other contexts.

The technique involves the intermediate use of a spreadsheet. I used the one in OpenOffice, but I'm pretty certain everything below can be reproduced in Excel as well. I also worked in the Brazilian Portuguese version of OpenOffice, so the function names used in the following formulas will need translating to the English equivalents. Still, that should be pretty obvious, for anyone with the minimum of programming experience, with a little assistance from the help in an English version of OpenOffice or Excel.

The steps:


 * go to your table, Italian_Open_(tennis), in Wikipedia and edit it to make it sortable:

Men's singles finals
{|class="wikitable sortable" style=font-size:90% =CONCATENAR("|- | " ;A1 ; SE(EXATO(ARRUMAR(B1); "Not Held") ;" || bgcolor=#cfcfcf|1936–1949||colspan=3 align=center bgcolor=#cfcfcf|Not Held"; CONCATENAR(" || '" ;DIREITA(ARRUMAR(B1); NÚM.CARACT(ARRUMAR(B1)) - PESQUISAR(" "; ARRUMAR(B1))) ;" ||  " ;DIREITA(ARRUMAR(C1); NÚM.CARACT(ARRUMAR(C1)) - PESQUISAR(" "; ARRUMAR(C1))) ;" || " ;D1))) =CONCATENAR("|- | " ;A48 ;" || '''" ;DIREITA(ARRUMAR(B48); NÚM.CARACT(ARRUMAR(B48)) - PESQUISAR(" "; ARRUMAR(B48))) ;" ||  " ;DIREITA(ARRUMAR(C48); NÚM.CARACT(ARRUMAR(C48)) - PESQUISAR(" "; ARRUMAR(C48))) ;" || " ;D48)
 * sort the table on the year to get the oldest to newest order that you want.
 * select all the data text (all the data rows and columns) in the sorted table.
 * use CTRL-C to copy.
 * open your OpenOffice|Excel Spreadsheet.
 * paste in A1 as unformatted text (you will be asked to confirm the interpretation parameters; just accept what is offered).
 * you should now find your table pasted neatly into 4 spreadsheet columns.
 * now go to the first empty cell on the first row (should be E1), and copy and paste the following as a formula:
 * check it produces a valid result; the result for E1 (1930) should be:
 * - | 1930 || '''States Bill Tilden || 🇮🇹 Uberto de Morpurgo || 6–1, 6–1, 6–2
 * select all the cells below 'E1' up to, and including, the row for 1989 (47).
 * paste the same formula.
 * now repeat for the remaining years using the following formula:
 * the result of the above for row 48 (1990) should be:
 * - | 1990 || 🇦🇹 '''Thomas Muster || Union Andrei Chesnokov || 6–1, 6–3, 6–1
 * select all the generated cells in column 'E' and copy and paste them into a text editor for final editing (such as replacing the country names with flagicon codes, and fixing the entries for countries with two part names).
 * back in Wikipedia delete all the data rows of your table.
 * back in your text editor select and copy the finalised wikitext.
 * back in Wikipedia paste the new data row wikitext into your wikitext table.
 * preview your newly formatted, reordered, table.

It would be possible to write formulas which generate EXACTLY the wikitext that you want, but, as that would be pretty tiresome for a one-off case, it is probably easier to fix the final details using the search and replace facilities in a normal text editor.

Hints for translating the Portuguese formula functions: CONCATENAR = CONCATENATE SE        = IF EXATO      = EXACTLY ESQUERDA  = LEFT ARRUMAR   = TIDY or TRIM PESQUISAR = SEARCH DIREITA   = RIGHT NÚM.CARACT = NUM.CHARS

Cricobr (talk) 02:54, 9 June 2011 (UTC)


 * There seems to be an easier way,using the website http://excel2wiki.net/wikipedia.php (which is mentioned at Tools).
 * After sorting the table as desired and copying the result into a spreadsheet program, copy and paste the table from that spreadsheet program into the converter Excel2Wiki and copy/paste its result back into the Wikipedia article's table. Note that sortable tables must not contain row spans. -- Michael Bednarek (talk) 05:45, 9 June 2011 (UTC)
 * I had tried copying it into a spreadsheet and the excell2wiki but the result looses all it flags nomenclature. It sorts it but strips it also. I'll poke around at Cricobr's fix but it looks more complicated than doing it by hand on Microsoft Word. Man... I was hoping wiki had some nice and easy fix for me. Thanks. Fyunck(click) (talk) 06:28, 9 June 2011 (UTC)
 * Type your data into an Excel spreadsheet and then when your finished use this excel to Wiki language converter to add all the wiki language in. This may not be a good way of doing it but its worth a shot.Jason Rees (talk) 16:44, 9 June 2011 (UTC)

Sorting ordinals in table
Sometimes editors use ordinal numbers in table columns. To make such a column always sort in the expected order, it is tempting to try sort, e.g. 1st, 2nd, 10th, 1000th, but this didn't work when I tried it. I look at Category:Sorting templates and didn't see any obvious alternatives. Any suggestions? 67.101.6.146 (talk) 02:47, 23 June 2011 (UTC) P.S. Here's a test case, with the last being the ordinal column:


 * P.S. Soon after I posted the question I tried 1st, 2nd, 10th, 1000th, which worked. Unless there's a template that is explicitly for ordinal numbers I guess that solution is fine.  67.101.6.146 (talk) 02:56, 23 June 2011 (UTC)

Including items in a 'wiki linked' column without the automatic wiki link
Sorry if the subject is confusing! I'm working on a page List of Doncaster Rovers F.C. players where the item entry is like this:


 * align=left|Tommy Cavanagh||IF ||1956–1959 ||119||16||124||18||
 * align=left|Tommy Cavanagh||IF ||1956–1959 ||119||16||124||18||

The problem I have is with players who don't yet have a page. I would like their names to appear in plain unlinked text so if someone does create a page with the same name but not the same person, the link won't turn blue. I can make it eg:


 * align=left|Tommy Cavanagh||IF ||1956–1959 ||119||16||124||18||
 * align=left|Tommy Cavanagh||IF ||1956–1959 ||119||16||124||18||

This would guard against this but is there any way of just keeping names as they are but in unlinked text?

Thanks! Cjwilky (talk) 16:17, 25 June 2011 (UTC)


 * Have you tried using the parameter 1 with Sortname? -- Michael Bednarek (talk) 05:24, 26 June 2011 (UTC)

List of trials of peers in the House of Lords
I tried to make this list sortable but when it didn't work properly. Can someone help me?--77.49.154.248 (talk) 19:24, 14 August 2011 (UTC)
 * Rows in sortable tables using  need special treatment; see Help:Table and Help:Table. It's probably simpler to place the text in those last two rows into one row and mark it as   or even have all that text outside and below the table. -- Michael Bednarek (talk) 04:58, 15 August 2011 (UTC)

Sortable table alterations?
Something has happened to the sortable table columns. They have become much wider, leading the table at Snooker world ranking points 2011/2012 to go off the side of the page. In Firefox this isn't so bad because you can at least scroll along. However, in Internet Explorer 8 it is impossible to even scroll along meaning we lose half the table. I'm sure our table isn't the only one affected on Wikipedia if the columns have been widened (which I didn't think was necessary to be honest because the chart looked better when it was fully on the page), but by not being able to scroll along in IE it has become virtually useless. It would be great if someone could address the IE issue. Betty Logan (talk) 17:04, 6 October 2011 (UTC)
 * Could be related to the update to 1.18 Mediawiki software. Feel free to publish an error report at the Village Pump (technical).  The Rambling Man (talk) 17:07, 6 October 2011 (UTC)
 * OK, thanks I will do that. Betty Logan (talk) 17:09, 6 October 2011 (UTC)
 * I just noticed this too. For me the issue is that columns with short headers are suddenly twice as wide as before, which wastes space and looks bad:
 * {|class="wikitable sortable"

!Age
 * 50
 * 12
 * }
 * It appears that during the 1.18 release the developers switched the underlying sortable table implementation to http://tablesorter.com, which I guess has a better sorting algorithm but a worse layout. I filed a complaint at Village Pump (technical) . - Morinao (talk) 20:39, 22 October 2011 (UTC)
 * Well, I tried. If anyone else cares, this is where I'm leaving it: . - Morinao (talk) 22:38, 22 October 2011 (UTC)
 * It appears that during the 1.18 release the developers switched the underlying sortable table implementation to http://tablesorter.com, which I guess has a better sorting algorithm but a worse layout. I filed a complaint at Village Pump (technical) . - Morinao (talk) 20:39, 22 October 2011 (UTC)
 * Well, I tried. If anyone else cares, this is where I'm leaving it: . - Morinao (talk) 22:38, 22 October 2011 (UTC)

"Numeric sort for BC/AD years" section's sorting not working correctly
When I try to sort the table in the "Numeric sort for BC/AD years" section on this help page by year, the ascending sort order goes like this:


 * ca.200 BC
 * c. 400 BC
 * ca.400 BC
 * ca. 500 BC
 * ca.700 BC
 * 1652
 * 1822
 * 1865
 * c. 8th century
 * c.900

(The descending order is the reverse of that). Seems that it's sorting by the hidden sort key, but using an alphabetical instead of numeric sort. I am using Firefox 3.6. 69.91.29.178 (talk) 00:58, 8 October 2011 (UTC)

Not Sortable Anymore
All the sortable tables I have created will not sort anymore. Seems to have happened in the last day or two. What has happened and how can I fix it? See Fasliyev for example. Tigerboy1966 (talk) 09:34, 8 October 2011 (UTC)


 * You have to define the header cells with !, not |. I don't have my head in the new sorter, so take this to WP:VPT. ---— Gadget850 (Ed)  talk 11:00, 8 October 2011 (UTC)
 * Thank you for your prompt response Gadget Tigerboy1966 (talk) 11:05, 8 October 2011 (UTC)

how do we sort numerically?
I'm confused. At List of natural satellites I placed a copy of all data in the Mean radius column in exponential form within Hs, yet it still sorts alphanumerically. I tried sort, which we use in another article, and still no go. What am I doing wrong? — kwami (talk) 13:25, 8 October 2011 (UTC)


 * See meta:Help:Sorting for the new sorting features. ---— Gadget850 (Ed)  talk 02:08, 10 October 2011 (UTC)


 * Thanks. Actually, I found a work-around with the old system: just add lots of zeros in front. Took me long enough to see it! — kwami (talk) 06:31, 10 October 2011 (UTC)

Styles in headers break sorting?
I notice, trying the examples, that adding  to a header cell causes sorting to be disabled for that column. although styling of cells still permits sorting Is there a workaround for this, or are sortable table headers doomed to be plain? --Lexein (talk) 04:25, 16 October 2011 (UTC)
 * I reported it as a bug at bugzilla --Lexein (talk) 23:40, 19 October 2011 (UTC)
 * Update: The dev-suggested workaround is to use   instead of  --Lexein (talk) 01:12, 18 December 2011 (UTC)

Sorting tables with multiple numbers of digits
I want to fix a table which, when sorted, sorts by the FIRST number, rather than the full number. For instance, from low to high, the table would sort as:

etc. I want it to sort by the value of the numbers instead. I am guessing that I use (ntsh), correct? littlebum2002 19:15, 19 October 2011 (UTC)
 * 1,000
 * 15
 * 2,000
 * 25


 * EDIT: Never mind, I am totally lost. Why does the table under Long-distance trails in the Republic of Ireland sort properly, but the table under List of NCAA football bowl records sorts in the way described earlier? I can't figure out the difference. — Preceding unsigned comment added by Littlebum2002 (talk • contribs) 19:21, 19 October 2011 (UTC)


 * The problem is related to the footnotes. The table correctly sorts the Losses column, but the Wins column is lexically sorted.  Same is true with the Ties (correctly sorted) and Bowl Games (lexical).  The distinguishing feature in both cases is that the correctly sorting columns do not have footnotes.  This article uses a mechanism I have not seen on wiki before:  an HTML-based linkage  .  Try replacing that with the standard wiki footnote markup using   or   and see if that fixes it.  If not, then an explicit sort key mechanism using one of the sort templates should work, though it is a bit harder to initially write.  —EncMstr (talk) 19:36, 19 October 2011 (UTC)


 * Thanks, I just realized the different columns in the same article sorted differently, and was coming to comment on it when I saw your response. I had a feeling it was an error: I would see no reason why Wikipedia would default to lexical sorting on something which should obviously sort by value. let me try the reference switch and see if it works littlebum2002 19:49, 19 October 2011 (UTC)


 * I fixed the footnotes issue, but the table still sorts lexically on those columns. This seems odd: could it be that any footnotes in a table stops it from sorting by value? This seems like a bug of some sort. littlebum2002 21:10, 19 October 2011 (UTC)


 * It's working as designed. The sort mechanism bases its sorting method on the data; a value of is not recognised as a numeric value. You have to use one of the sorting templates which create hidden sort keys. -- Michael Bednarek (talk) 03:39, 20 October 2011 (UTC)


 * I instead moved the notes to another column, but I have seen other pages which have this same problem that I will try to fix using the hidden keys. It makes sense that the software sees the reference tags as text behind the numbers, thus converting the table to sort lexically. It just seems that reference tags would be an exception. So it is not a bug, but IMO it is something that could and should be fixed. I don;t think every table in the encyclopedia that uses references should have to put hidden tags everywhere. I wrote a bug report, but I think I will change it into a modification request instead. littlebum2002 12:08, 20 October 2011 (UTC)

Template:Static column begin. Problem with multi-row headers
This is about keeping the rows aligned between the fixed row number column and the table to its right. Please see the top table on this page:
 * List of U.S. states and territories by incarceration and correctional supervision rate. For example; see this specific revision.

Static column begin works easiest when there is a header column that spans all the header rows. Then I can make the header-height parameter value match up with the main table wikitext for the height of the header that spans all the rows. The header height is set high enough (270px in this case) to allow readers to expand the text size to around 133% and not break row alignment. It is easier to see this in the example and wikitext below. Rank redirects to Static column begin.

{|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right; !Jurisdiction !Yearend 2016. In prison or jail !2016 rate per 100,000 adults !2016 rate per 100,000 of all ages !rowspan=4 class=unsortable height=270px| Problem is that this table has 4 header rows. I had to add a blank column on the right in order to have a header column that spanned (via rowspan) the 4 header rows. Can I make that column narrower, or even invisible?
 * -valign=bottom

Is there another way to get the static row column to perfectly align with the table rows? Can a template editor fix this in the template itself? -- Timeshifter (talk) 12:08, 25 November 2019 (UTC)
 * This makes it narrow: . It gets no space between the left and right border so it looks like one thick border. PrimeHunter (talk) 00:43, 26 November 2019 (UTC)


 * Thanks! Here is the table with that styling added to the spanning header cell:

I explained all this in the documentation: -- Timeshifter (talk) 02:42, 26 November 2019 (UTC)
 * Template:Static column begin/doc


 * Here is a version of the table below using em units for the height parameters. It is more compact because there is no white space at the top of the headers, and because the text alone can be zoomed to very high levels without losing row alignment. See the updated documentation.

Even better is this method using header-lines=10 parameter:

Here is how that empty spanning header is formatted so that  works: -- Timeshifter (talk) 03:38, 7 December 2019 (UTC)

Default sorting on page load?
How can I define a default sort when page loads? And if there isn't any method how can one be added, I'm not asking this question for Wikipedia only Someone asked this as example: https://stackoverflow.com/questions/16140758/default-sort-column-in-wikipedia-table

Karl-police (talk) 11:55, 6 December 2019 (UTC)
 * , you cannot, you have to sort it yourself. This is for performance reasons. Doing it serverside is difficult to implement, doing it client side would cause the table to dynamically change during page load, which is undesirable. —Th e DJ (talk • contribs) 13:39, 6 December 2019 (UTC)


 * Maybe, but at the end all it should do is like the client cliks with the mouse on the header, just run that function? But that isn't possible then? Karl-police (talk) 15:48, 6 December 2019 (UTC)
 * It would also mean the initial table is different for users without JavaScript, or in print, in PDF conversions, when saved to disk, and so on. I think it would be too confusing. If another initial sort order is important then editors should implement it for everybody in the source. PrimeHunter (talk) 21:36, 7 December 2019 (UTC)
 * and : See also: Village pump (technical) - Check the archives once it moves there. See also: T240114: "Enhance the VisualEditor table editor to allow sorting and saving sorted content." -- Timeshifter (talk) 01:42, 9 December 2019 (UTC)
 * Hm? Karl-police (talk) 16:33, 14 December 2019 (UTC)
 * The original poster in the Village Pump discussion had the same basic question as you. The phabricator task is seeking to make the VisualEditor capable of sorting tables in the wikitext. Alphabetically or by rank. So that the initial sort is changed more easily. -- Timeshifter (talk) 22:10, 14 December 2019 (UTC)

Incorrect BC/AD date sorting?
I came to this page to look up how to properly sort BC/AD dates. I followed the example exactly and my dates didn't sort properly, at which point I realized that the dates on this page don't sort properly either. Anybody know what's up? Yuliya (talk) 19:57, 2 January 2020 (UTC)
 * Which table are you talking about? For me works both the two tables in #Before year 100. Any date format and the second and fourth in #Year, month, day. Using numbers. ISO date (the other two are said to be broken, so I haven’t tried them), in Firefox (68.3) as well as in Chromium (v73). —Tacsipacsi (talk) 23:08, 2 January 2020 (UTC)
 * I'm using Chrome. The section I am looking at is called "Numeric sort for BC/AD years".  Instead of sorting large BC -> small BC -> small AD -> large AD, it seems to sort small BC -> large BC -> small AD -> large AD. Yuliya (talk) 18:06, 3 January 2020 (UTC)
 * I put a slightly modified version of the table in my sandbox (permalink). Do you see a different result when sorting? The issue might be related to the fact that the wikitext has a non-breaking space (U+00A0) in the Hs for 500 BC. Johnuniq (talk) 03:07, 4 January 2020 (UTC)
 * Ignore that. There is a problem which I'm scratching my head over. Unfortunately when I simplify the table the problem goes away. Johnuniq (talk) 04:20, 4 January 2020 (UTC)

I fixed the example in my sandbox (permalink). It shows that the trick to force numeric sorting of the date column does not work. Perhaps it once did, but it does not now. Sorting the Number and Date columns should give the same order. In the first table (using Help:Sorting), it fails. The second table shows the approved method using. @WOSlinker: You understand this stuff much more than me. Do you agree that my sandbox shows the information in the current Help:Sorting is wrong and should be updated per my sandbox? Johnuniq (talk) 06:08, 4 January 2020 (UTC)
 * Yes, your sandbox looks correct. There is also Template:Date table sorting which can be used to generate the sort keys. -- WOSlinker (talk) 09:25, 4 January 2020 (UTC)

Do you agree that the "example in my sandbox" linked just above shows that Help:Sorting is incorrect? You have done most recent editing to the page. Do you want to fix it? Johnuniq (talk) 05:54, 5 January 2020 (UTC)


 * As far as I can remember I didn't create or edit the section of Help:Sorting in question. I tried looking at it and your sandbox, but I haven't spent the time to figure out everything. I am working on other things right now, and it may be a long time before I have time for this. -- Timeshifter (talk) 08:28, 5 January 2020 (UTC)
 * OK, no problem. I might fix it but likewise that could take some time. Johnuniq (talk) 09:07, 5 January 2020 (UTC)

Since I started all this, I could edit. I don't do much of it, but I think I understand what is to be done. The organization of that particular section does not make sense to me, it should be folded into the rest of the dates and they already cover how to do this. Also, the table used as an example is already fixed in the article it was taken from, so I think it would be sufficient to list it as an additional example in the dates section. Yuliya (talk) 20:28, 6 January 2020 (UTC)

Date sorting problems
According to the "Month, Day and Year" and "Day, Month and Year" subsections of the "Date sorting problems" this help page, all the tables shown there should sort properly. In reality they don't. The first two tables of both subsections actually sort alphabetically on the name of the month when using the sort button. I've included a screen shot to illustrate this.Tvx1 22:22, 11 February 2020 (UTC)
 * , it works for me. What browser do you use, and what are your languages settings ? —Th e DJ (talk • contribs) 22:40, 11 February 2020 (UTC)
 * i'm pretty sure your interface language isn't set to english, and then it will use non-english names of the month to attempt the matching with. This is a known problem. —Th e DJ (talk • contribs) 23:00, 11 February 2020 (UTC)
 * Do you mean the Internationalisation Language setting at Special:Preferences? Mine is set to en - English and the sorting does not work for me. I was about to post an example showing that using the crazy date format at meta:Help:Sorting works but I'll leave that for now until the language issue is clarified. Johnuniq (talk) 02:56, 12 February 2020 (UTC)
 * Sorting works for me with [//en.wikipedia.org/wiki/Help:Sorting?uselang=en#Month,_day,_and_year en] but not with other languages like [//en.wikipedia.org/wiki/Help:Sorting?uselang=fr#Month,_day,_and_year fr]. Does the en link sort wrong for you after you have clicked the column heading? PrimeHunter (talk) 03:25, 12 February 2020 (UTC)
 * I clicked the column heading to sort the columns and I did that for each table at Help:Sorting. However, I must have had a brain failure because it is working now. Without your  links, and with your [//en.wikipedia.org/wiki/Help:Sorting?uselang=en#Month,_day,_and_year en] link, when the column heading on the last table shows ▲ I see the following which is in correct ascending order by date:
 * January 7, 1999
 * December 5, 1999
 * May 14, 2004
 * August 4, 2004
 * Actually, all four of the tables sort correctly. I knew that I had to enable scripting for the sorting to work but maybe some glitch occurred with that, or maybe I'm nuts:( Johnuniq (talk) 04:12, 12 February 2020 (UTC)
 * , you're right. My interface language is set to my native Dutch. When I switch to English the sorting works fine.Tvx1 18:58, 12 February 2020 (UTC)
 * It seems worth a mention so I have added Help:Sorting with:
 * All sorting involving month names may fail for registered users who have changed the default language setting "en - English" at Special:Preferences. It affects relatively few users and can be ignored.
 * There are possible fixes like using month numbers or sort keys but I don't think we should bother with that. PrimeHunter (talk) 19:58, 12 February 2020 (UTC)

# query
Hi all, a quick question if that's OK. In a text column, what should the entry #6 sort as? As if it were "number six"? Just "six"? Or something else entirely?

Thanks in advance! -- ChrisTheDude (talk) 09:49, 27 March 2020 (UTC)
 * I would sort it as "6". I guess this is about #7 at List of Top Country Albums number ones of 1986. PrimeHunter (talk) 14:16, 27 March 2020 (UTC)
 * Yeah that's the one. Don't know why I typed #6 above - brain fart, clearly ;-) -- ChrisTheDude (talk) 14:32, 27 March 2020 (UTC)

Mobile Sorting
Sortable tables work on my desktop computer, but when I view them with the Wikipedia app, I'm unable to sort. Is this something that Wiki-markup teams are working on, or am I not using the correct Wiki-markup for my sortable tables?Comm260 ncu (talk) 22:03, 29 June 2020 (UTC)
 * Same here. I think it is just a limitation of the app. T181452 seems rather old. &mdash; GhostInTheMachine talk to me 23:00, 29 June 2020 (UTC)

List of stars for navigation
The main sortable table in this article seems to have been bolloxed for something like 10 years. I've tried to figure it out, but couldn't find a simple fix. Could someone with more experience with these sortable tables please help sort it out? Skyerise (talk) 22:00, 5 September 2020 (UTC)

parameters and auto-sorting tables
What do the 'create', 'order', 'numeric', and 'ascending'/'descending' parameters and more mean, how do they function, and how do I use 'colspan' and 'rowspan', and use multiple headers or place headers in different locations on Module:AutosortTable, and how do I auto-sort tables and use the 'create', 'order', 'numeric', and 'ascending'/'descending' and the other parameters on tables? -- PK2 (talk) 22:07, 21 August 2020 (UTC)
 * , I don't think Module:AutosortTable is really being used much, if at all. See: "What links here":
 * Special:WhatLinksHere/Module:AutosortTable
 * --Timeshifter (talk) 03:53, 23 August 2020 (UTC)
 * . There is more discussion at Help talk:Table. --Timeshifter (talk) 06:43, 6 September 2020 (UTC)

Trouble with currency sorting
I can't get Lists of institutions of higher education by endowment size to function. I'm not the best at tables/sorting; could someone help? &#123;{u&#124; Sdkb  }&#125;  talk 21:07, 21 September 2020 (UTC)

Sorting doesn't work on a specific table
Hello, I recently created some tables for an article, United States nickel mintage figures. most of them work fine, but the table labeled, "post-war compositions, 1946-2003" does not sort. any idea why? Thanks.Skeletonwizard8 (talk) 21:58, 20 January 2021 (UTC)
 * changed rowspan="5" in the final row to rowspan="3". It was upset by the missing 2 rows — GhostInTheMachine talk to me 22:59, 20 January 2021 (UTC)
 * ThanksSkeletonwizard8 (talk) 17:36, 21 January 2021 (UTC)

did something happen to break data-sort-values?
I'm seeing work but setting data-sort-values not work (for example in tables in Tatiana Maslany). Has there been a recent change that has screwed up data-sort-value? —Joeyconnick (talk) 02:52, 25 March 2021 (UTC)
 * You wrote  in the article. Fixed in . PrimeHunter (talk) 11:10, 25 March 2021 (UTC)
 * Oh my gosh... sorry! That would explain things. *sigh* —Joeyconnick (talk) 18:47, 25 March 2021 (UTC)

Sorting years and months
Hi, I recently added a column "Duration of record" to this table. https://en.wikipedia.org/wiki/Triple_jump_world_record_progression The problem is that that column doesn't sort properly. Can anyone help? Thanks Bright Orion |  talk  10:53, 6 August 2021 (UTC)
 * The sort is based on the text being displayed by the templates. So 11 months ..., 20 days, 25 years ... is correct for text. You can force a numeric sort by adding a hidden sort key in front of the displayed text. Sort by the age in days should work. I have added sort keys like this 28 years, 11 months, but please check that I copied the dates correctly — GhostInTheMachine talk to me 14:17, 6 August 2021 (UTC)
 * Thank you so much! The data seems to be correct. There's just one record that still doesn't sort properly. Adhemar da Silva (BRA)	23 July 1952--Helsinki, Finland--11 months and 26 days. This is coming up as the third longest record, when it shouldn't be. Any ideas?   Bright Orion |  talk  14:45, 6 August 2021 (UTC)
 * The value is 361 days but is being sorted as text between 3532 (9 years ...) and 3681 (10 years ...). Moving the sort values to be attributes of the table cells seems to be safer. ... etc.15:29, 6 August 2021 (UTC) — GhostInTheMachine talk to me
 * Perfect! The table seems to be OK now. Thanks! Bright Orion |  talk  16:35, 6 August 2021 (UTC)

Applying sorting to the top row of headings, not lower ones
Hello. I regularly see sortable tables like this where the sorting arrows appear in the compressed colours row and aren't visible. Is there any way to get the sorting to apply to the top row of headers instead? Cheers, Number   5  7  18:32, 24 October 2021 (UTC)


 * See: Help:Sorting
 * You can add a break in the row of colors (as below), and thus make the row taller. But there are still no sorting icons due to the problem described in the above section of Help:Sorting.
 * So I changed to  style="background-color:...  and this put the sorting icons back in the bottom header row. That is where Mediawiki software always puts the sorting icon. I don't know how to force them to be in another header row.
 * You could put the row of colors above the other header row. See farther down. I also removed the width settings in the second table. They are not helpful. Table naturally seeks least width that allows one line per row without laddering if possible.
 * It is better to use the row of colors for the sorting icons. This makes the table narrower.
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px"
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px"

! rowspan="2"| Province ! style="width:40px;"| PvdA ! style="width:40px;"| CDA ! style="width:40px;"| VVD ! style="width:40px;"| D'66 ! style="width:40px;"| SGP ! style="width:40px;"| CPN ! style="width:40px;"| PPR ! style="width:40px;"| GPV ! style="width:40px;"| PSP ! style="width:40px;"| BP ! style="width:40px;"| DS'70 ! style="width:40px;" rowspan="2"| Others ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"| ! style="background-color:;"|
 * - style="height:40px;"
 * align="left"| Drenthe
 * style="background-color:#F6C5C1;"|41.5
 * 27.1
 * 18.2
 * 4.4
 * 0.4
 * 1.2
 * 1.4
 * 1.8
 * 0.6
 * 1.3
 * 0.6
 * 1.5
 * align="left"| Friesland
 * 37.3
 * style="background-color:#BADBD3;"| 37.4
 * 12.3
 * 4.4
 * 0.9
 * 1.5
 * 1.3
 * 1.6
 * 0.8
 * 0.6
 * 0.6
 * 1.3
 * align="left"| Gelderland
 * 30.8
 * style="background-color:#BADBD3;"| 35.5
 * 17.2
 * 4.8
 * 3.7
 * 0.6
 * 1.7
 * 0.7
 * 0.9
 * 1.4
 * 0.5
 * 2.2
 * align="left"| Groningen
 * style="background-color:#F6C5C1;"|42.4
 * 24.3
 * 14.4
 * 4.4
 * 0.3
 * 4.3
 * 1.9
 * 4.0
 * 1.3
 * 0.7
 * 0.6
 * 1.4
 * align="left"| Limburg (Netherlands)
 * 30.1
 * style="background-color:#BADBD3;"| 44.6
 * 14.7
 * 3.3
 * 0.1
 * 1.1
 * 1.9
 * 0.1
 * 0.7
 * 1.0
 * 0.4
 * 2.0
 * align="left"| North Brabant
 * 28.8
 * style="background-color:#BADBD3;"| 43.7
 * 15.7
 * 5.0
 * 0.5
 * 0.6
 * 1.6
 * 0.2
 * 0.8
 * 1.1
 * 0.5
 * 1.5
 * align="left"| North Holland
 * style="background-color:#F6C5C1;"|35.4
 * 22.9
 * 21.7
 * 7.3
 * 0.5
 * 4.5
 * 2.1
 * 0.4
 * 1.5
 * 0.6
 * 1.2
 * 1.9
 * align="left"| Overijssel
 * 31.0
 * style="background-color:#BADBD3;"| 39.5
 * 13.2
 * 4.2
 * 2.9
 * 1.1
 * 1.3
 * 2.2
 * 0.5
 * 1.2
 * 0.4
 * 2.5
 * align="left"| South Holland
 * style="background-color:#F6C5C1;"|37.9
 * 24.6
 * 19.9
 * 6.1
 * 3.8
 * 1.3
 * 1.5
 * 0.8
 * 0.8
 * 0.4
 * 0.9
 * 2.0
 * align="left"| Flevoland
 * style="background-color:#F6C5C1;"|33.1
 * 29.0
 * 18.9
 * 6.7
 * 1.0
 * 2.9
 * 2.8
 * 1.3
 * 0.6
 * 0.6
 * 0.7
 * 2.4
 * align="left"| Utrecht
 * 28.2
 * style="background-color:#BADBD3;"| 30.5
 * 22.1
 * 6.6
 * 3.2
 * 0.9
 * 1.9
 * 1.6
 * 1.3
 * 0.7
 * 0.7
 * 2.3
 * align="left"| Zeeland
 * style="background-color:#F6C5C1;"|32.6
 * 29.8
 * 17.3
 * 4.4
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px;"
 * 17.3
 * 4.4
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px;"
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px;"
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px;"
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px;"

! rowspan="2"| Province ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! style="background-color:;" | ! rowspan="2"| Others ! PvdA ! CDA ! VVD ! D'66 ! SGP ! CPN ! PPR ! GPV ! PSP ! BP ! DS'70
 * align="left"| Drenthe
 * style="background-color:#F6C5C1;"|41.5
 * 27.1
 * 18.2
 * 4.4
 * 0.4
 * 1.2
 * 1.4
 * 1.8
 * 0.6
 * 1.3
 * 0.6
 * 1.5
 * align="left"| Friesland
 * 37.3
 * style="background-color:#BADBD3;"| 37.4
 * 12.3
 * 4.4
 * 0.9
 * 1.5
 * 1.3
 * 1.6
 * 0.8
 * 0.6
 * 0.6
 * 1.3
 * align="left"| Gelderland
 * 30.8
 * style="background-color:#BADBD3;"| 35.5
 * 17.2
 * 4.8
 * 3.7
 * 0.6
 * 1.7
 * 0.7
 * 0.9
 * 1.4
 * 0.5
 * 2.2
 * align="left"| Groningen
 * style="background-color:#F6C5C1;"|42.4
 * 24.3
 * 14.4
 * 4.4
 * 0.3
 * 4.3
 * 1.9
 * 4.0
 * 1.3
 * 0.7
 * 0.6
 * 1.4
 * align="left"| Limburg (Netherlands)
 * 30.1
 * style="background-color:#BADBD3;"| 44.6
 * 14.7
 * 3.3
 * 0.1
 * 1.1
 * 1.9
 * 0.1
 * 0.7
 * 1.0
 * 0.4
 * 2.0
 * align="left"| North Brabant
 * 28.8
 * style="background-color:#BADBD3;"| 43.7
 * 15.7
 * 5.0
 * 0.5
 * 0.6
 * 1.6
 * 0.2
 * 0.8
 * 1.1
 * 0.5
 * 1.5
 * align="left"| North Holland
 * style="background-color:#F6C5C1;"|35.4
 * 22.9
 * 21.7
 * 7.3
 * 0.5
 * 4.5
 * 2.1
 * 0.4
 * 1.5
 * 0.6
 * 1.2
 * 1.9
 * align="left"| Overijssel
 * 31.0
 * style="background-color:#BADBD3;"| 39.5
 * 13.2
 * 4.2
 * 2.9
 * 1.1
 * 1.3
 * 2.2
 * 0.5
 * 1.2
 * 0.4
 * 2.5
 * align="left"| South Holland
 * style="background-color:#F6C5C1;"|37.9
 * 24.6
 * 19.9
 * 6.1
 * 3.8
 * 1.3
 * 1.5
 * 0.8
 * 0.8
 * 0.4
 * 0.9
 * 2.0
 * align="left"| Flevoland
 * style="background-color:#F6C5C1;"|33.1
 * 29.0
 * 18.9
 * 6.7
 * 1.0
 * 2.9
 * 2.8
 * 1.3
 * 0.6
 * 0.6
 * 0.7
 * 2.4
 * align="left"| Utrecht
 * 28.2
 * style="background-color:#BADBD3;"| 30.5
 * 22.1
 * 6.6
 * 3.2
 * 0.9
 * 1.9
 * 1.6
 * 1.3
 * 0.7
 * 0.7
 * 2.3
 * align="left"| Zeeland
 * style="background-color:#F6C5C1;"|32.6
 * 29.8
 * 17.3
 * 4.4
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * --Timeshifter (talk) 00:06, 25 October 2021 (UTC)
 * You can make it a non-header row with  to keep it at the top during sorting. I don't think you can combine header and non-header cells in the same row so I removed  rowspan=2 from "Province" and "Others" in the below table, and added empty cells in the color row. It might look better with background color similar to the header cells and no visible border. PrimeHunter (talk) 00:11, 25 October 2021 (UTC)
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px"
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * --Timeshifter (talk) 00:06, 25 October 2021 (UTC)
 * You can make it a non-header row with  to keep it at the top during sorting. I don't think you can combine header and non-header cells in the same row so I removed  rowspan=2 from "Province" and "Others" in the below table, and added empty cells in the color row. It might look better with background color similar to the header cells and no visible border. PrimeHunter (talk) 00:11, 25 October 2021 (UTC)
 * {| class="wikitable sortable" style="text-align:center;font-size:90%;line-height:14px"

! Province ! PvdA ! CDA ! VVD ! D'66 ! SGP ! CPN ! PPR ! GPV ! PSP ! BP ! DS'70 ! Others
 * - style="height:40px;"
 * - class="sorttop"
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * style="background:;"|
 * align="left"| Drenthe
 * style="background:#F6C5C1;"|41.5
 * 27.1
 * 18.2
 * 4.4
 * 0.4
 * 1.2
 * 1.4
 * 1.8
 * 0.6
 * 1.3
 * 0.6
 * 1.5
 * align="left"| Friesland
 * 37.3
 * style="background:#BADBD3;"| 37.4
 * 12.3
 * 4.4
 * 0.9
 * 1.5
 * 1.3
 * 1.6
 * 0.8
 * 0.6
 * 0.6
 * 1.3
 * align="left"| Gelderland
 * 30.8
 * style="background:#BADBD3;"| 35.5
 * 17.2
 * 4.8
 * 3.7
 * 0.6
 * 1.7
 * 0.7
 * 0.9
 * 1.4
 * 0.5
 * 2.2
 * align="left"| Groningen
 * style="background:#F6C5C1;"|42.4
 * 24.3
 * 14.4
 * 4.4
 * 0.3
 * 4.3
 * 1.9
 * 4.0
 * 1.3
 * 0.7
 * 0.6
 * 1.4
 * align="left"| Limburg (Netherlands)
 * 30.1
 * style="background:#BADBD3;"| 44.6
 * 14.7
 * 3.3
 * 0.1
 * 1.1
 * 1.9
 * 0.1
 * 0.7
 * 1.0
 * 0.4
 * 2.0
 * align="left"| North Brabant
 * 28.8
 * style="background:#BADBD3;"| 43.7
 * 15.7
 * 5.0
 * 0.5
 * 0.6
 * 1.6
 * 0.2
 * 0.8
 * 1.1
 * 0.5
 * 1.5
 * align="left"| North Holland
 * style="background:#F6C5C1;"|35.4
 * 22.9
 * 21.7
 * 7.3
 * 0.5
 * 4.5
 * 2.1
 * 0.4
 * 1.5
 * 0.6
 * 1.2
 * 1.9
 * align="left"| Overijssel
 * 31.0
 * style="background:#BADBD3;"| 39.5
 * 13.2
 * 4.2
 * 2.9
 * 1.1
 * 1.3
 * 2.2
 * 0.5
 * 1.2
 * 0.4
 * 2.5
 * align="left"| South Holland
 * style="background:#F6C5C1;"|37.9
 * 24.6
 * 19.9
 * 6.1
 * 3.8
 * 1.3
 * 1.5
 * 0.8
 * 0.8
 * 0.4
 * 0.9
 * 2.0
 * align="left"| Flevoland
 * style="background:#F6C5C1;"|33.1
 * 29.0
 * 18.9
 * 6.7
 * 1.0
 * 2.9
 * 2.8
 * 1.3
 * 0.6
 * 0.6
 * 0.7
 * 2.4
 * align="left"| Utrecht
 * 28.2
 * style="background:#BADBD3;"| 30.5
 * 22.1
 * 6.6
 * 3.2
 * 0.9
 * 1.9
 * 1.6
 * 1.3
 * 0.7
 * 0.7
 * 2.3
 * align="left"| Zeeland
 * style="background:#F6C5C1;"|32.6
 * 29.8
 * 17.3
 * 4.4
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * PrimeHunter (talk) 00:11, 25 October 2021 (UTC)
 * Another advantage of putting the sorting icons in the row of colors is that there are no links in those color cells. The link in a cell makes it difficult to quickly click the sorting cell without clicking the link. --Timeshifter (talk) 00:37, 25 October 2021 (UTC)
 * I don't really see why the colors are there to begin with. They aren't accessible for screen readers and don't seem to portray any info. Given it isn't coloring data but a blank cell, it is either unnecessary or portrays info only through color. MOS:COLOR: "Ensure that color is not the only method used to communicate important information." Also, it can be argued that hiding the sortable links/arrows (e.g. 1977 Dutch general election) goes against "Links should clearly be identifiable as a link to our readers." and probably MOS:EGG, which the arrows indicate sorting links when present as well as the sort order once clicked (ascending, descending or both [unsorted] arrows). Jroberson108 (talk) 06:18, 12 February 2022 (UTC)
 * After a second glance, I see the colors are supposed to represent the different parties. There are so many colors that I would never use them to try and find related data in another table. I would just use the header text. Jroberson108 (talk) 06:31, 12 February 2022 (UTC)
 * 4.4
 * 8.4
 * 0.4
 * 1.5
 * 1.6
 * 0.5
 * 1.0
 * 0.6
 * 1.9
 * }
 * PrimeHunter (talk) 00:11, 25 October 2021 (UTC)
 * Another advantage of putting the sorting icons in the row of colors is that there are no links in those color cells. The link in a cell makes it difficult to quickly click the sorting cell without clicking the link. --Timeshifter (talk) 00:37, 25 October 2021 (UTC)
 * I don't really see why the colors are there to begin with. They aren't accessible for screen readers and don't seem to portray any info. Given it isn't coloring data but a blank cell, it is either unnecessary or portrays info only through color. MOS:COLOR: "Ensure that color is not the only method used to communicate important information." Also, it can be argued that hiding the sortable links/arrows (e.g. 1977 Dutch general election) goes against "Links should clearly be identifiable as a link to our readers." and probably MOS:EGG, which the arrows indicate sorting links when present as well as the sort order once clicked (ascending, descending or both [unsorted] arrows). Jroberson108 (talk) 06:18, 12 February 2022 (UTC)
 * After a second glance, I see the colors are supposed to represent the different parties. There are so many colors that I would never use them to try and find related data in another table. I would just use the header text. Jroberson108 (talk) 06:31, 12 February 2022 (UTC)

Possible locale-dependent sort bug
As reported by in, there seems to be a locale-dependent bug when trying to sort dates with month names in English with the user's Wikipedia language set to Italian. I cannot reproduce the problem myself. What is the best place to report this bug with the little information we have for further investigation? --Fernando Trebien (talk) 02:14, 3 June 2022 (UTC)
 * It's mentioned at Help:Sorting and T126744. PrimeHunter (talk) 11:47, 3 June 2022 (UTC)
 * Thank you! --Fernando Trebien (talk) 16:07, 3 June 2022 (UTC)
 * Wrapping the dates with dts seems to work around the issue while increasing editing complexity. Maybe we could mention this in ? --Fernando Trebien (talk) 18:50, 3 June 2022 (UTC)
 * I guess more than 99.9% of page views are from unregistered users or users with the default English, or British or Canadian English which also works. I don't think we should add complications. PrimeHunter (talk) 19:24, 3 June 2022 (UTC)

Template to request sorting of a list?
Wondering if there is a template that can go in a list article saying something like "This list needs to be sorted" (alphabetically, alphabetically by surname and first name, by date (oldest first or newest first), etc.)? There seems to be a lot of articles that could use this, e.g. WP:Requested articles/Social sciences. Thanks! Facts707 (talk) 13:31, 14 April 2022 (UTC)


 * Responding late, but better late than never. @Facts707, is the template you are looking for. Qwerty284651 (talk) 05:07, 30 October 2022 (UTC)
 * Thanks qwerty! I have added an MOS section MOS:LISTSORT and a couple links to make list sorting a little easier to find.
 * Cheers, Facts707 (talk) 05:54, 30 October 2022 (UTC)
 * Good thinking with adding a MOS section and shortcuts to it. Didn't know one can just add a MOS guideline just like that. Also, good choice for the shortcut names. Best, Qwerty284651 (talk) 22:07, 30 October 2022 (UTC)

Problem w table
At List_of_possible_dwarf_planets, I'm having trouble getting the density value of Dysnomia (1.8–2.4) to sort properly. I'd like it to sort at its midpoint (2.1) as other data do. — kwami (talk) 07:54, 29 November 2022 (UTC)
 * Looks like you had Dysnomia's "data-sort-value" set to . I changed it to , which sorts properly now. Jroberson108 (talk) 13:21, 29 November 2022 (UTC)
 * Ah, so we need the closing braces. That's where I went wrong. I thought that if I used the html codes, they wouldn't be treated as code. (That's what our help page claims.) Strange that we need to use proper template syntax for a string that is not treated as template syntax. — kwami (talk) 16:20, 29 November 2022 (UTC)
 * Also, I suggest changing the format of the value to match the others for consistency sake from 1.8–2.4 to 2.1±0.3. By doing this, you won't need to specify a "data-sort-value" like the others. Jroberson108 (talk) 13:28, 29 November 2022 (UTC)

Moved
I moved this from Help:Sorting to Help:Sortable tables. The entire page is about sortable tables, not about sorting data in general (sorting lists, sorting stubs, etc.). Cheers, Manifestation (talk) 20:22, 13 February 2023 (UTC)

Shortcuts discussion at Template talk:Wikipedia how-to
and others. Please do not revert this diff:
 * https://en.wikipedia.org/w/index.php?title=Help%3ASortable_tables&diff=1142601037&oldid=1142587424

Wait until there is a solution at Template talk:Wikipedia how-to. If the template editors allow the text to wrap around the shortcuts box, then the revision can be reverted. --Timeshifter (talk) 09:55, 3 March 2023 (UTC)


 * Unless you are proposing to modify all pages using this template until it is fixed for mobile, I can't see the reason for modifying for this specific page GiovanniSidwell (talk) 16:54, 6 March 2023 (UTC)
 * I am proposing that the template be modified. That fixes the problem for all pages. Can you modify the template? I don't know enough to fix the template, or I would do it. --Timeshifter (talk) 05:23, 7 March 2023 (UTC)

Scopes
Scopes are not needed on simple tables.

More info:
 * Wikipedia talk:Manual of Style/Accessibility/Data tables tutorial/Archive 2.
 * Wikipedia talk:Manual of Style/Accessibility/Data tables tutorial.

But if people want to add the scopes to simple tables that is up to them, and what they do with their time.

Some of the Wikipedia info is out of date, going back to a time when scopes mattered on simple tables. Screen readers are much better now.

I believe MOS:SIMPLIFY applies and the KISS Principle. Why make things more difficult for the average Wikipedia editor?

There are accessibility guidelines that actually make a difference. Like getting rid of nested tables. I removed most of them from Help:Table and Help:Sortable tables. That took a lot of time. There may be some remaining. I don't have as much health and time as I used to. So others may have to finish the job. --Timeshifter (talk) 17:29, 13 March 2023 (UTC)


 * You'd have more time if you didn't work so hard to revert every change to one of "your" pages. You could also save time by reducing the unnecessary bolding of your text. It's like you don't want us to read it, or something. &mdash; JohnFromPinckney (talk / edits) 15:05, 16 March 2023 (UTC)
 * Average editors in general would have more time if they weren't burdened with incorrect information about using out-of-date scope rules.
 * Bolding helps focus on the main points, and the links. This saves most people time. --Timeshifter (talk) 16:55, 16 March 2023 (UTC)
 * This saves most people time. I remain unconvinced, until you point to some empirical data.
 * And there would be more time saved in the aggregate, if our examples used correct mark-up. This Help page should provide a good model, and when you refuse to use even  markup (via  ), you do all interested editors a disservice. &mdash; JohnFromPinckney (talk / edits) 13:12, 17 March 2023 (UTC)
 * Asking people to add unnecessary scopes to simple tables takes more time. You don't need a double-blind study to see that. Making things unnecessarily complicated goes against the spirit of MOS:SIMPLIFY. It discourages editors too.
 * Making the first column a header column when it is obviously not a header column is illogical. --Timeshifter (talk) 16:42, 17 March 2023 (UTC)
 * I agree that scope on simple tables where only the first row and/or only the first column consists of heading cells, is not required for screenreaders and generally is just not useful to specify.
 * There is one note of interest however, and that is that we have a plainrowheaders class which undos some of the table heading styling, which relies on scope having been specified (because there is no other way to reliably find the 'first' cell when you using row and colspans to taget them with CSS).
 * Additionally when multi row or column headings are used, especially when combined with row or column spanning, they theoretically might be useful as well (though I'm not entirely sure if there is any screenreader which actually does anything with this information. —Th e DJ (talk • contribs) 22:06, 17 March 2023 (UTC)
 * . Your last paragraph is what I am curious about. As I said previously, I spent hours removing nested tables from help pages because I knew it actually mattered for screen readers.
 * Help:Table has some info concerning complex tables: Tables with multi row or column headings, and row or column spanning. But it is not backed up by references outside Wikipedia. Nor backed up by info from people using current screen readers. --Timeshifter (talk) 04:00, 18 March 2023 (UTC)

doesn't seem to work properly
When the example table for data-sort-type=text is sorted ascending, it comes out like this:

Album 19 19 21 21 21 21 193 215 Everything Is New Love & War Matinée But if it is sorting lexically, shouldn't 193 come before 21? Since the character '1' comes lexically before '2'. Keith D. Tyler &para; 08:55, 16 March 2023 (UTC)


 * . Concerning:
 * Help:Sortable tables
 * The only thing I could find doing Google searches is this:
 * Natural sort order
 * Need someone with knowledge of how the MediaWiki software is sorting alphabetically.
 * Could ask at Village pump (technical).
 * --Timeshifter (talk) 12:20, 16 March 2023 (UTC)
 * I asked at Village pump (technical). --Timeshifter (talk) 12:27, 16 March 2023 (UTC)
 * It uses locale specific collation, with number preservation enabled. https://github.com/wikimedia/mediawiki/blob/master/resources/src/jquery.tablesorter/jquery.tablesorter.js#L772 —Th e DJ (talk • contribs) 13:42, 16 March 2023 (UTC)
 * . Is "number preservation" what natural sort order uses? --Timeshifter (talk) 13:55, 16 March 2023 (UTC)
 * More the other way around the collator's option to preserve numeric order, implies that it is using a natural sort order. —Th e DJ (talk • contribs) 14:01, 16 March 2023 (UTC)
 * . I am confused by all the terminology. So data-sort-type=text is using alphabetical sorting of text, but numbers are sorted numerically within that alphabetical sorting? --Timeshifter (talk) 14:21, 16 March 2023 (UTC)
 * Correct. —Th e DJ (talk • contribs) 22:08, 17 March 2023 (UTC)
 * This raises two big questions. One, why is it "data-sort-type=text" if it does not actually do text-based sorting? (It ought to be data-sort-type-natural since that is what it does.) And further, how does one get true lexical sort on a column, including for numbers? Keith D. Tyler &para; 18:16, 5 April 2023 (UTC)
 * It's interesting, too, that such a behavior-changing code change was implemented so silently -- and with no documentation updates. - Keith D. Tyler &para; 18:28, 5 April 2023 (UTC)

and. Per our discussion I updated the info here (and the following section): --Timeshifter (talk) 02:01, 18 March 2023 (UTC)
 * Help:Sortable tables

Sorting a singular name into a list
How would you sort a singular name - say Bruma, into a group of names (with a first and last name) that is sorted by their surname? The only way I can think to do it leaves a space before the name like: ' Bruma' instead of simply 'Bruma'. I'm using the sortname template. MessiIsMyBezzie (talk) 21:58, 26 April 2023 (UTC)


 * oh no - ignore me, when I preview the page the space isn't there so it should be all good. MessiIsMyBezzie (talk) 22:04, 26 April 2023 (UTC)

Quotes are not needed unless there is a space in the value
See discussion at Help talk:Table. --Timeshifter (talk) 00:34, 4 May 2023 (UTC)