Help talk:Sortable tables/Archive 4
Sorting issueI 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 issueDoes 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)
Lexical order (Greek)When I sort by the second column (the Greek names) in Lefktro#Settlements, 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)
Alfie↑↓© 10: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 cellSometimes 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 fieldsLike 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 Wikipedia: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)
This page is scaryI 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) StripingThis 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 RowIs 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 ProblemsI 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)
problems with sorting by datesI'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)
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-valueIt seems to me that the HTML attribute
Reverse order a table permanentlyI'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:
=== Men's singles finals === {|class="wikitable sortable" style=font-size:90%
=CONCATENAR("|-<br>| " ;A1 ; SE(EXATO(ARRUMAR(B1); "Not Held") ;" || bgcolor=#cfcfcf|1936–1949||colspan=3 align=center bgcolor=#cfcfcf|''Not Held"; CONCATENAR(" || {{flagicon|" ;ESQUERDA(ARRUMAR(B1); PESQUISAR(" "; ARRUMAR(B1)) - 1) ;"}} '''[[" ;DIREITA(ARRUMAR(B1); NÚM.CARACT(ARRUMAR(B1)) - PESQUISAR(" "; ARRUMAR(B1))) ;"]] || {{flagicon|" ;ESQUERDA(ARRUMAR(C1); PESQUISAR(" "; ARRUMAR(C1)) - 1) ;"}} [[" ;DIREITA(ARRUMAR(C1); NÚM.CARACT(ARRUMAR(C1)) - PESQUISAR(" "; ARRUMAR(C1))) ;"]] || " ;D1)))
|-<br>| 1930 || {{flagicon|United}} '''[[States Bill Tilden]] || {{flagicon|Italy}} [[Uberto de Morpurgo]] || 6–1, 6–1, 6–2
=CONCATENAR("|-<br>| [[" ;A48 ;" Internazionali BNL d'Italia – Men's Singles|" ;A48 ;"]] || {{flagicon|" ;ESQUERDA(ARRUMAR(B48); PESQUISAR(" "; ARRUMAR(B48)) - 1) ;"}} '''[[" ;DIREITA(ARRUMAR(B48); NÚM.CARACT(ARRUMAR(B48)) - PESQUISAR(" "; ARRUMAR(B48))) ;"]] || {{flagicon|" ;ESQUERDA(ARRUMAR(C48); PESQUISAR(" "; ARRUMAR(C48)) - 1) ;"}} [[" ;DIREITA(ARRUMAR(C48); NÚM.CARACT(ARRUMAR(C48)) - PESQUISAR(" "; ARRUMAR(C48))) ;"]] || " ;D48)
|-<br>| [[1990 Internazionali BNL d'Italia – Men's Singles|1990]] || {{flagicon|Austria}} '''[[Thomas Muster]] || {{flagicon|Soviet}} [[Union Andrei Chesnokov]] || 6–1, 6–3, 6–1
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)
Sorting ordinals in tableSometimes 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. {{sort|1|1st}}, {{sort|2|2nd}}, {{sort|10|10th}}, {{sort|1000|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:
Including items in a 'wiki linked' column without the automatic wiki linkSorry 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:
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)
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)
"Numeric sort for BC/AD years" section's sorting not working correctlyWhen 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:
(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 AnymoreAll 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)
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)
Styles in headers break sorting?I notice, trying the examples, that adding
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)
Sorting tables with multiple numbers of digitsI 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)
Template:Static column begin. Problem with multi-row headersThis 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:
{{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}}. {{Rank| rows=2| header-text=Row| header-height=270px| text-align=right| caption=Incarceration rates by state.}} {|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right; |-valign=bottom !Jurisdiction !Yearend<br>2016. In<br>prison<br>or jail !2016<br>rate per<br>100,000<br>adults !2016<br>rate per<br>100,000<br>of all ages !rowspan=4 class=unsortable height=270px|<!--Header column is needed for {{Rank}} template.--> |- {{Rank| rows=2| header-text=Row| header-height=270px| text-align=right| caption=Incarceration rates by state.}}
{|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right;
|-valign=bottom
!Jurisdiction
!Yearend<br>2016. In<br>prison<br>or jail
!2016<br>rate per<br>100,000<br>adults
!2016<br>rate per<br>100,000<br>of all ages
!rowspan=4 class=unsortable height=270px|<!--Header column is needed for {{Rank}} template.-->
|-
!US total
!2,131,000
!850
!660
|-
!Federal
!188,400
!80
!60
|-
!States, and<br>[[District of Columbia]]
!1,942,600
!780
!600
|-
| style=text-align:left; |{{Flag|Alabama}}||40,900||1,080||840
|-
| style=text-align:left; |{{Flag|Alaska}}||4,400||800||600
|}
{{End}}
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? 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)
{{Rank| rows=2| header-text=Row| header-height=270px| text-align=right| caption=Incarceration rates by state.}}
{|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right;
|-valign=bottom
!Jurisdiction
!Yearend<br>2016. In<br>prison<br>or jail
!2016<br>rate per<br>100,000<br>adults
!2016<br>rate per<br>100,000<br>of all ages
!rowspan=4 class=unsortable height=270px style="padding-left:0;padding-right:0;"|<!--The spanning header cell height is needed for {{Rank}} row alignment.-->
|-
!US total
!2,131,000
!850
!660
|-
!Federal
!188,400
!80
!60
|-
!States, and<br>[[District of Columbia]]
!1,942,600
!780
!600
|-
| style=text-align:left; |{{Flag|Alabama}}||40,900||1,080||840
|-
| style=text-align:left; |{{Flag|Alaska}}||4,400||800||600
|}
{{End}}
I explained all this in the documentation: -- Timeshifter (talk) 02:42, 26 November 2019 (UTC)
{{Rank| rows=2| header-text=Row| header-height=14.19em| text-align=right| caption=Incarceration rates by state.}}
{|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right;
|-valign=bottom
!Jurisdiction
!Yearend<br>2016. In<br>prison<br>or jail
!2016<br>rate per<br>100,000<br>adults
!2016<br>rate per<br>100,000<br>of all ages
!height=14.19em rowspan=4 class=unsortable style="padding-left:0;padding-right:0;"|<!--The spanning header cell height is needed for {{Rank}} row alignment.-->
|-
!US total
!2,131,000
!850
!660
|-
!Federal
!188,400
!80
!60
|-
!States, and<br>[[District of Columbia]]
!1,942,600
!780
!600
|-
| style=text-align:left; |{{Flag|Alabama}}||40,900||1,080||840
|-
| style=text-align:left; |{{Flag|Alaska}}||4,400||800||600
|}
{{End}}
Even better is this method using header-lines=10 parameter: Here is how that empty spanning header is formatted so that {{Rank| rows=2| header-text=Row| header-lines=10| text-align=right| caption=Incarceration rates by state.}}
{|class="wikitable nowrap sortable mw-datatable" border=1 style=text-align:right;
|-valign=bottom
!Jurisdiction
!Yearend<br>2016. In<br>prison<br>or jail
!2016<br>rate per<br>100,000<br>adults
!2016<br>rate per<br>100,000<br>of all ages
!rowspan=4 class=unsortable style="padding-left:0;padding-right:0;"|<br><br><br><br><br><br><br><br><br><br><!--The spanning header cell is needed for {{Rank}} row alignment.-->
|-
!US total
!2,131,000
!850
!660
|-
!Federal
!188,400
!80
!60
|-
!States, and<br>[[District of Columbia]]
!1,942,600
!780
!600
|-
| style=text-align:left; |{{Flag|Alabama}}||40,900||1,080||840
|-
| style=text-align:left; |{{Flag|Alaska}}||4,400||800||600
|}
{{End}}
-- 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)
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)
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
@Timeshifter: Do you agree that the "example in my sandbox" linked just above shows that Help:Sorting#Numeric sort for BC/AD years 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)
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)
# queryHi 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)
Mobile SortingSortable 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)
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 tablesWhat 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)
Trouble with currency sortingI can't get Lists of institutions of higher education by endowment size#All others over US$ 1 billion to function. I'm not the best at tables/sorting; could someone help? {{u|Sdkb}} talk 21:07, 21 September 2020 (UTC) Sorting doesn't work on a specific tableHello, 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)
did something happen to break data-sort-values?I'm seeing
Sorting years and monthsHi, 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 BrightOrion | talk 10:53, 6 August 2021 (UTC)
Applying sorting to the top row of headings, not lower onesHello. 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 57 18:32, 24 October 2021 (UTC)
Possible locale-dependent sort bugAs reported by Emanuele676 in Talk:2022 monkeypox outbreak § Changes made to the table, 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)
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#Sociology people. Thanks! Facts707 (talk) 13:31, 14 April 2022 (UTC)
Problem w tableAt List_of_possible_dwarf_planets#Largest_measured_candidates, 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)
MovedI 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-toChompy Ace and others. Please do not revert this diff: 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)
ScopesScopes are not needed on simple tables. More info:
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)
|
1 | 2 | 3 |
---|---|---|
a | b | c |
- Standard wikitable, caption after columns
1 | 2 | 3 |
---|---|---|
a | b | c |
- Sortable wikitable, caption before columns
1 | 2 | 3 |
---|---|---|
a | b | c |
d | e | f |
- Sortable wikitable, caption after columns
1 | 2 | 3 |
---|---|---|
a | b | c |
d | e | f |
SFB 20:48, 23 August 2023 (UTC)
- I would just follow the examples on Help:Table where the table caption is placed before the headers.
Only between table start and first table row.
Jroberson108 (talk) 21:59, 23 August 2023 (UTC)
- Sillyfolkboy. Could you give examples using {{AchievementTable}}? --Timeshifter (talk) 02:15, 24 August 2023 (UTC)
- Timeshifter See previous example on Mo Farah here. This template contains parameters for defining both the table and the column, so users cannot apply a custom caption in wikitext when this template is used. I've found various cases, particularly with British athletes who naturally represent multiple nations, so I assume there are numerous instances of this in articles, but they are not easily identifiable without a manual search. I've updated the template to allow for multiple nations in the caption so the use case is covered and can be fixed by adding detail to the template parameters, but thought I'd raise this as the behaviour differs between sortable and regular wikitable. SFB 10:56, 24 August 2023 (UTC)
- @Sillyfolkboy: Sounds like this discussion should be moved to that template page. To clarify, what you are referring to is a table caption, which is not the same as headers in a table; otherwise it will get confusing. From the template and your recent edit, it displays a table caption of 1-2 flags/countries or, if doesn't have flag for the "nation" value, the text along with "Representing". As previously stated, the table caption has to be above all other rows including the column headers. I did a search for the code usage and found a lot where the table caption was moved to a "colspan" row of column headers, which doesn't mess up sorting. Search results. On the Christian Coleman page, there are two such tables like this: International competitions and National championships. Note that the "National championships" table doesn't show countries or flags. This improvised row of column headers would be more properly displayed as a table caption and would help with accessibility (screen readers), which is something that would need to be fixed on that template or those tables. A solution would be to add what they want displayed in the table caption along with any flags and links to the "nation" parameter, which would allow for multiple in one parameter. It would be better to discuss other solutions on that template page. Jroberson108 (talk) 22:01, 24 August 2023 (UTC)
- @Jroberson108: Thanks for the correction! The nation parameter of that template already has a check so if something other than a nation is added (e.g. a team or club) then this will display in plain text. I'll have a think about how to best allow a "team" or "caption" option here... SFB 17:46, 25 August 2023 (UTC)
- @Sillyfolkboy: IMHO, I think users might be confused on the name of the parameter of "nation" ("caption" might have been better?), so doc clarity about its use in the table caption and recommended format ("the", which flag template, "&" for multiple, etc.) for consistency might help alleviate that issue. The "nation2" parameter could also be reverted if the doc is clear. This would also alleviate the need of adding additional parameters like "team" or "club" so it stays simple. Jroberson108 (talk) 18:48, 25 August 2023 (UTC)
- @Jroberson108: The "nation" parameter has been there for nearly a decade and using it to show one national team accounts for 95%+ of usages. I've added the caption aspect this week purely because of this difference in table behaviour. It is very rarely used for non-national captions with this template. I'll add a caption parameter as an alt of nation and document that, as it already doubles for that usage anyway through the link check. SFB 20:37, 25 August 2023 (UTC)
- @Sillyfolkboy: I wasn't suggesting changing the "nation" parameter or the template logic around it, only documenting that it can be used for non-nations and even multiples where you would have to manually add any nation flags yourself. Adding a "caption" parameter would be clear, although the "nation" parameter also affects the table caption, so maybe specify they use one or the other. Might be good to discuss on that template's talk page with those involved? Jroberson108 (talk) 22:25, 25 August 2023 (UTC)
- I just looked and saw you are the original creator of the template, so I guess discuss there if needed. Looks like you already added the "caption" parameter. Glad you found a solution. Jroberson108 (talk) 22:44, 25 August 2023 (UTC)
- @Jroberson108: The "nation" parameter has been there for nearly a decade and using it to show one national team accounts for 95%+ of usages. I've added the caption aspect this week purely because of this difference in table behaviour. It is very rarely used for non-national captions with this template. I'll add a caption parameter as an alt of nation and document that, as it already doubles for that usage anyway through the link check. SFB 20:37, 25 August 2023 (UTC)
- @Sillyfolkboy: IMHO, I think users might be confused on the name of the parameter of "nation" ("caption" might have been better?), so doc clarity about its use in the table caption and recommended format ("the", which flag template, "&" for multiple, etc.) for consistency might help alleviate that issue. The "nation2" parameter could also be reverted if the doc is clear. This would also alleviate the need of adding additional parameters like "team" or "club" so it stays simple. Jroberson108 (talk) 18:48, 25 August 2023 (UTC)
- @Jroberson108: Thanks for the correction! The nation parameter of that template already has a check so if something other than a nation is added (e.g. a team or club) then this will display in plain text. I'll have a think about how to best allow a "team" or "caption" option here... SFB 17:46, 25 August 2023 (UTC)
- @Sillyfolkboy: Sounds like this discussion should be moved to that template page. To clarify, what you are referring to is a table caption, which is not the same as headers in a table; otherwise it will get confusing. From the template and your recent edit, it displays a table caption of 1-2 flags/countries or, if doesn't have flag for the "nation" value, the text along with "Representing". As previously stated, the table caption has to be above all other rows including the column headers. I did a search for the code usage and found a lot where the table caption was moved to a "colspan" row of column headers, which doesn't mess up sorting. Search results. On the Christian Coleman page, there are two such tables like this: International competitions and National championships. Note that the "National championships" table doesn't show countries or flags. This improvised row of column headers would be more properly displayed as a table caption and would help with accessibility (screen readers), which is something that would need to be fixed on that template or those tables. A solution would be to add what they want displayed in the table caption along with any flags and links to the "nation" parameter, which would allow for multiple in one parameter. It would be better to discuss other solutions on that template page. Jroberson108 (talk) 22:01, 24 August 2023 (UTC)
- Timeshifter See previous example on Mo Farah here. This template contains parameters for defining both the table and the column, so users cannot apply a custom caption in wikitext when this template is used. I've found various cases, particularly with British athletes who naturally represent multiple nations, so I assume there are numerous instances of this in articles, but they are not easily identifiable without a manual search. I've updated the template to allow for multiple nations in the caption so the use case is covered and can be fixed by adding detail to the template parameters, but thought I'd raise this as the behaviour differs between sortable and regular wikitable. SFB 10:56, 24 August 2023 (UTC)
Sillyfolkboy. It is good to bring such problems to both here and the template page. I have seen some buggy interactions between templates and sortable tables. For example:
- Help:Sortable tables#Sorting row template - see note at top about sorting problem.
- Template:Static row numbers header#Static data rows. Another sorting problem.
- T344562. Row moving over one cell. Table bug using certain templates.
And between colspan and a template:
So one has to find a workaround. Go with whatever works until better solutions are found. It looks like templates used at or near the top of sortable tables can be a problem. You may need to do without the template in some specific circumstances. Or the use of specific parameters may be required. Both should be listed in the template documentation. --Timeshifter (talk) 05:26, 25 August 2023 (UTC)
- @Timeshifter: Thanks for including the context :) I've implemented support for two nations/captions in the affected template, plus inclusion of the team as column data rather than a caption. Alongside Jroberson108's other solution I think we've got enough functionality to handle all the use cases in some way! SFB 17:46, 25 August 2023 (UTC)
List of historical earthquakes
Can someone knowledgeable can lend a hand here, please: Talk:List_of_historical_earthquakes#Date_Ordering. Thanks! fgnievinski (talk) 00:44, 6 September 2023 (UTC)
Discussion at Wikipedia:User scripts/Requests § Sortkeys in lists
You are invited to join the discussion at Wikipedia:User scripts/Requests § Sortkeys in lists. {{u|Sdkb}} talk 15:40, 12 January 2024 (UTC)
Sort under template

I created the {{sort under}} template to reposition the sorting arrows under the text without the issues that come with adding sorting buttons in a separate row. Please review and mention any issues on its talk page. Jroberson108 (talk) 20:25, 28 January 2024 (UTC)
Comments are requested there specifically concerning whether the default class=sort-under should be centered sorting icons or right-aligned sorting icons. Or even left-aligned ones. --Timeshifter (talk) 21:46, 28 January 2024 (UTC)
- For those who are interested. Someone at the technical Village Pump suggested going to this MOS discussion page since it is a style discussion, and not a technical problem. See:
- Wikipedia talk:Manual of Style/Tables#Template:Sort under
- --Timeshifter (talk) 14:11, 4 February 2024 (UTC)
sorting strictly alphabetically - impossible?
see Help:Sortable tables#Forcing a column to have a particular data type: data-sort-type=text uses alphabetical sorting of text, but numbers are sorted numerically within that alphabetical sorting.
Isn't there any possibility to get a column sorted strictly alphabetically instead of Natural sort order, so 0R11 before 0R9 ?
Many thanks, Aspiriniks (talk) 11:38, 17 April 2024 (UTC)
P.S. I see there was a related discussion one year ago at Help_talk:Sortable_tables/Archive_4#data-sort-type=text_doesn't_seem_to_work_properly - any news since then? -- Aspiriniks (talk) 11:56, 17 April 2024 (UTC)
- @Aspiriniks: You might want to ask at WP:VPT or WP:Phabricator. --Timeshifter (talk) 14:44, 18 April 2024 (UTC)
- @Aspiriniks: You'll need to adjust the cell's sort value to get the desired order. For "0R9", change it to
| data-sort-value=0R90 | 0R9
to sort as: 0R11, 0R12, 0R9. A similar sort value would be needed for any other cell values that aren't four characters long. Jroberson108 (talk) 04:52, 19 April 2024 (UTC)
Sorting titles, some with appended text
Hello, regarding List of cult films: K, it seems like the listings The Killer and The Killing, both which neighbor listings that have longer titles starting with Killer or Killing, wind up at the bottom of each respective group when sorting alphabetically, when they should come first, having nothing after that keyword. Am I doing something wrong? Is there a way to fix it? Erik (talk | contrib) (ping me) 14:24, 23 May 2024 (UTC)
I guess I fixed it by adding two spaces after each title, but this feels like too much of a hack. Is there a proper way to do this? Erik (talk | contrib) (ping me) 14:26, 23 May 2024 (UTC)
- No idea. Maybe ask at {{sortname}} too. --Timeshifter (talk) 14:50, 23 May 2024 (UTC)
- I considered that, but it redirects to Template talk:Sort, which does not seem very active. Other suggestions for places to ask would be great. Erik (talk | contrib) (ping me) 14:52, 23 May 2024 (UTC)
- Maybe WP:VPT. --Timeshifter (talk) 15:47, 23 May 2024 (UTC)
- I considered that, but it redirects to Template talk:Sort, which does not seem very active. Other suggestions for places to ask would be great. Erik (talk | contrib) (ping me) 14:52, 23 May 2024 (UTC)
Sorting rowspan groups with sortbottom
Sorting the following table with class=sortbottom for the bottom 2 rows removes the blank rows, displaying thusly. Qwerty284651 (talk) 21:13, 1 July 2024 (UTC)
- The rowspan number was wrong. I temporarily added {{static row numbers}} to see that. Also, I added dashes in the blank spots in the bottom 2 rows. Both changes were needed to fix the problem. See diff.
- An easier solution is to eliminate the blank columns. And list those years above the table. It would also make the table narrower. --Timeshifter (talk) 06:53, 2 July 2024 (UTC)
- Yeah, that's the alternative I had with removing the years and adding a note above the table about the skipped years. Btw, why does static row display blank without bgcolor? Qwerty284651 (talk) 12:56, 2 July 2024 (UTC)
Template:Year in date-sorted table
I just created Template:Year in date-sorted table as the inverse of Template:Date table sorting. I welcome input if there are better solutions to achieve the same goal, additional features that would be useful, and or suggestions for a more descriptive template name. Daask (talk) 20:24, 16 July 2024 (UTC)
- You might get more discussion at Help talk:Table or WP:VPT. I am not really into this now. --Timeshifter (talk) 00:27, 18 July 2024 (UTC)