![]() | This is an archive of past discussions about Help:Sortable tables. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 | Archive 3 | Archive 4 |
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)
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)
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)
English | Greek | population |
---|---|---|
Agios Nikolaos | Άγιος Νικόλαος | 508 |
Agios Nikonos | Άγιος Νίκωνος | 146 |
Kardamyli | Καρδαμύλη (Έδρα) | 447 |
Total | 1,101 |
Alfie↑↓© 10:44, 22 September 2010 (UTC)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
It seems to me that the HTML attribute data-sort-value=
(see mediawiki implementation) makes the hidden sort templates {{hs}} and {{hid}} obsolete. Many other templates which use <span style="display:none"> … </span>
, 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 list of plays by Nestroy. -- Michael Bednarek (talk) 12:48, 24 February 2011 (UTC)
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:
=== 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)
class="wikitable sortable"
) 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)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. {{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:
Juror # | Character | 1954 actor | 1957 actor | 1997 actor | 2004–2005 actor | 2006–2007 actor | Votes 'not guilty' |
---|---|---|---|---|---|---|---|
1 | The jury foreman | Norman Fell | Martin Balsam | Courtney B. Vance | Mark Blum | George Wendt | 9th |
2 | An unpretentious bank clerk | John Beal | John Fiedler | Ossie Davis | Kevin Greer | Todd Cerveris | 5th |
3 | A businessman and distraught father; the antagonist | Franchot Tone | Lee J. Cobb | George C. Scott | Philip Bosco | Randle Mell | 12th |
4 | A stockbroker, unflappable and self-assured, strong and analytical | Walter Abel | E. G. Marshall | Armin Mueller-Stahl | James Rebhorn | Jeffrey Hayenga | 11th |
5 | A young man from a violent slum, a Baltimore Orioles fan | Lee Phillips | Jack Klugman | Dorian Harewood | Michael Mastro | Jim Saltouros | 3rd |
6 | A house painter, tough, principled, and respectful | Bart Burns | Edward Binns | James Gandolfini | Robert Clohessy | Charles Borland | 6th |
7 | A salesman, sports fan, indifferent to the deliberations | Paul Hartman | Jack Warden | Tony Danza | John Pankow | Mark Morettini | 7th |
8 | An architect, the first dissenter; the protagonist | Robert Cummings | Henry Fonda | Jack Lemmon | Boyd Gaines | Richard Thomas | 1st |
9 | A wise and observant elderly man | Joseph Sweeney | Joseph Sweeney | Hume Cronyn | Tom Aldredge | Alan Mandell | 2nd |
10 | A garage owner and bigot | Edward Arnold | Ed Begley | Mykelti Williamson | Peter Friedman | Julian Gamble | 10th |
11 | A watchmaker and naturalized American citizen | George Voskovec | George Voskovec | Edward James Olmos | Larry Bryggman | David Lively | 4th |
12 | A wisecracking, advertising executive | William West | Robert Webber | William Petersen | Adam Trese | Craig Wroe | 8th |
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||
|-
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||
|-
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)
|nolink=1
with {{Sortname}}? -- Michael Bednarek (talk) 05:24, 26 June 2011 (UTC)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)
colspan=
need special treatment; see Help:Table#Excluding rows from sorting and Help:Table#Colspan workaround. It's probably simpler to place the text in those last two rows into one row and mark it as class="sortbottom"
or even have all that text outside and below the table. -- Michael Bednarek (talk) 04:58, 15 August 2011 (UTC)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)
Age |
---|
50 |
12 |
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:
(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)
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)
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)
I notice, trying the examples, that adding style="background:#cfcfcf;"
to a header cell causes sorting to be disabled for that column.
Name | Surname | Height |
---|---|---|
John | Smith | 1.85 |
Ron | Ray | 1.89 |
Mario | Bianchi | 1.72 |
Average: | 1.82 |
although styling of cells still permits sorting
Name | Surname | Height |
---|---|---|
John | Smith | 1.85 |
Ron | Ray | 1.89 |
Mario | Bianchi | 1.72 |
Average: | 1.82 |
Is there a workaround for this, or are sortable table headers doomed to be plain? --Lexein (talk) 04:25, 16 October 2011 (UTC)
style="background-color:#cfcfcf"
instead of "backgound"
--Lexein (talk) 01:12, 18 December 2011 (UTC)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)
<sup id="inlined" class="reference">[[#noted|[d]]]</sup>
. Try replacing that with the standard wiki footnote markup using <ref>...,</ref>
or <ref name=.../>
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)123<ref group=a name=y />
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)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:
{{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)
style="padding-left:0;padding-right:0;"
. 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){{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 header-lines=10
works:
!rowspan=4 class=unsortable style="padding-left:0;padding-right:0;"|<br><br><br><br><br><br><br><br><br><br>
{{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)
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)
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 data-sort-type="number"
. @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)
@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)
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)
uselang
links, and with your en link, when the column heading on the last table shows ▲ I see the following which is in correct ascending order by date:
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)
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)
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)
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 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)
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)
I'm seeing {{sortname}}
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)
data-source-value
in the article. Fixed in [3]. PrimeHunter (talk) 11:10, 25 March 2021 (UTC)
Hi, I recently added a column "Duration of record" to this table. https://en.wikipedia.orghttps://demo.azizisearch.com/lite/wikipedia/page/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)
{{Hidden sort key|{{age in days|1995|8|7}}}}{{age in years and months |1995|8|7}}
, but please check that I copied the dates correctly — GhostInTheMachine talk to me 14:17, 6 August 2021 (UTC)
... ||data-sort-value="{{age in days|1952|7|23|1953|7|19}}" | {{Age in years, months and days|1952|7|23|1953|7|19}}
etc.15:29, 6 August 2021 (UTC) — GhostInTheMachine talk to me
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 57 18:32, 24 October 2021 (UTC)
Province | PvdA | CDA | VVD | D'66 | SGP | CPN | PPR | GPV | PSP | BP | DS'70 | Others |
---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
41.5 | 27.1 | 18.2 | 4.4 | 0.4 | 1.2 | 1.4 | 1.8 | 0.6 | 1.3 | 0.6 | 1.5 |
![]() |
37.3 | 37.4 | 12.3 | 4.4 | 0.9 | 1.5 | 1.3 | 1.6 | 0.8 | 0.6 | 0.6 | 1.3 |
![]() |
30.8 | 35.5 | 17.2 | 4.8 | 3.7 | 0.6 | 1.7 | 0.7 | 0.9 | 1.4 | 0.5 | 2.2 |
![]() |
42.4 | 24.3 | 14.4 | 4.4 | 0.3 | 4.3 | 1.9 | 4.0 | 1.3 | 0.7 | 0.6 | 1.4 |
![]() |
30.1 | 44.6 | 14.7 | 3.3 | 0.1 | 1.1 | 1.9 | 0.1 | 0.7 | 1.0 | 0.4 | 2.0 |
![]() |
28.8 | 43.7 | 15.7 | 5.0 | 0.5 | 0.6 | 1.6 | 0.2 | 0.8 | 1.1 | 0.5 | 1.5 |
![]() |
35.4 | 22.9 | 21.7 | 7.3 | 0.5 | 4.5 | 2.1 | 0.4 | 1.5 | 0.6 | 1.2 | 1.9 |
![]() |
31.0 | 39.5 | 13.2 | 4.2 | 2.9 | 1.1 | 1.3 | 2.2 | 0.5 | 1.2 | 0.4 | 2.5 |
![]() |
37.9 | 24.6 | 19.9 | 6.1 | 3.8 | 1.3 | 1.5 | 0.8 | 0.8 | 0.4 | 0.9 | 2.0 |
![]() |
33.1 | 29.0 | 18.9 | 6.7 | 1.0 | 2.9 | 2.8 | 1.3 | 0.6 | 0.6 | 0.7 | 2.4 |
![]() |
28.2 | 30.5 | 22.1 | 6.6 | 3.2 | 0.9 | 1.9 | 1.6 | 1.3 | 0.7 | 0.7 | 2.3 |
![]() |
32.6 | 29.8 | 17.3 | 4.4 | 8.4 | 0.4 | 1.5 | 1.6 | 0.5 | 1.0 | 0.6 | 1.9 |
Province | Others | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
PvdA | CDA | VVD | D'66 | SGP | CPN | PPR | GPV | PSP | BP | DS'70 | ||
![]() |
41.5 | 27.1 | 18.2 | 4.4 | 0.4 | 1.2 | 1.4 | 1.8 | 0.6 | 1.3 | 0.6 | 1.5 |
![]() |
37.3 | 37.4 | 12.3 | 4.4 | 0.9 | 1.5 | 1.3 | 1.6 | 0.8 | 0.6 | 0.6 | 1.3 |
![]() |
30.8 | 35.5 | 17.2 | 4.8 | 3.7 | 0.6 | 1.7 | 0.7 | 0.9 | 1.4 | 0.5 | 2.2 |
![]() |
42.4 | 24.3 | 14.4 | 4.4 | 0.3 | 4.3 | 1.9 | 4.0 | 1.3 | 0.7 | 0.6 | 1.4 |
![]() |
30.1 | 44.6 | 14.7 | 3.3 | 0.1 | 1.1 | 1.9 | 0.1 | 0.7 | 1.0 | 0.4 | 2.0 |
![]() |
28.8 | 43.7 | 15.7 | 5.0 | 0.5 | 0.6 | 1.6 | 0.2 | 0.8 | 1.1 | 0.5 | 1.5 |
![]() |
35.4 | 22.9 | 21.7 | 7.3 | 0.5 | 4.5 | 2.1 | 0.4 | 1.5 | 0.6 | 1.2 | 1.9 |
![]() |
31.0 | 39.5 | 13.2 | 4.2 | 2.9 | 1.1 | 1.3 | 2.2 | 0.5 | 1.2 | 0.4 | 2.5 |
![]() |
37.9 | 24.6 | 19.9 | 6.1 | 3.8 | 1.3 | 1.5 | 0.8 | 0.8 | 0.4 | 0.9 | 2.0 |
![]() |
33.1 | 29.0 | 18.9 | 6.7 | 1.0 | 2.9 | 2.8 | 1.3 | 0.6 | 0.6 | 0.7 | 2.4 |
![]() |
28.2 | 30.5 | 22.1 | 6.6 | 3.2 | 0.9 | 1.9 | 1.6 | 1.3 | 0.7 | 0.7 | 2.3 |
![]() |
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="sorttop"
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)Province | PvdA | CDA | VVD | D'66 | SGP | CPN | PPR | GPV | PSP | BP | DS'70 | Others |
---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
41.5 | 27.1 | 18.2 | 4.4 | 0.4 | 1.2 | 1.4 | 1.8 | 0.6 | 1.3 | 0.6 | 1.5 |
![]() |
37.3 | 37.4 | 12.3 | 4.4 | 0.9 | 1.5 | 1.3 | 1.6 | 0.8 | 0.6 | 0.6 | 1.3 |
![]() |
30.8 | 35.5 | 17.2 | 4.8 | 3.7 | 0.6 | 1.7 | 0.7 | 0.9 | 1.4 | 0.5 | 2.2 |
![]() |
42.4 | 24.3 | 14.4 | 4.4 | 0.3 | 4.3 | 1.9 | 4.0 | 1.3 | 0.7 | 0.6 | 1.4 |
![]() |
30.1 | 44.6 | 14.7 | 3.3 | 0.1 | 1.1 | 1.9 | 0.1 | 0.7 | 1.0 | 0.4 | 2.0 |
![]() |
28.8 | 43.7 | 15.7 | 5.0 | 0.5 | 0.6 | 1.6 | 0.2 | 0.8 | 1.1 | 0.5 | 1.5 |
![]() |
35.4 | 22.9 | 21.7 | 7.3 | 0.5 | 4.5 | 2.1 | 0.4 | 1.5 | 0.6 | 1.2 | 1.9 |
![]() |
31.0 | 39.5 | 13.2 | 4.2 | 2.9 | 1.1 | 1.3 | 2.2 | 0.5 | 1.2 | 0.4 | 2.5 |
![]() |
37.9 | 24.6 | 19.9 | 6.1 | 3.8 | 1.3 | 1.5 | 0.8 | 0.8 | 0.4 | 0.9 | 2.0 |
![]() |
33.1 | 29.0 | 18.9 | 6.7 | 1.0 | 2.9 | 2.8 | 1.3 | 0.6 | 0.6 | 0.7 | 2.4 |
![]() |
28.2 | 30.5 | 22.1 | 6.6 | 3.2 | 0.9 | 1.9 | 1.6 | 1.3 | 0.7 | 0.7 | 2.3 |
![]() |
32.6 | 29.8 | 17.3 | 4.4 | 8.4 | 0.4 | 1.5 | 1.6 | 0.5 | 1.0 | 0.6 | 1.9 |
As 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)
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)
{{unsorted list}}
is the template you are looking for. Qwerty284651 (talk) 05:07, 30 October 2022 (UTC)
At 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)
{{val|2.1
. I changed it to {{val|2.1}}
, which sorts properly now. Jroberson108 (talk) 13:21, 29 November 2022 (UTC)
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)
Chompy 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)
Scopes 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)
This saves most people time.[citation needed] I remain unconvinced, until you point to some empirical data.
<th>
markup (via !
), you do all interested editors a disservice. — JohnFromPinckney (talk / edits) 13:12, 17 March 2023 (UTC)
data-sort-type=text
doesn't seem to work properlyWhen 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 ¶ 08:55, 16 March 2023 (UTC)
KeithTyler and TheDJ. Per our discussion I updated the info here (and the following section):
--Timeshifter (talk) 02:01, 18 March 2023 (UTC)
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)
See discussion at Help talk:Table. --Timeshifter (talk) 00:34, 4 May 2023 (UTC)
The article only talks about using data-sort-value with text. It should give examples with numbers. Main questions I had were
- do I need to surround it with quotes data-sort-value="22" or data-sort-value=22
- do I need to (or does it help) to also manually specify the data-type Akeosnhaoe (talk) 15:29, 24 July 2023 (UTC)
I observed a problem in instances of {{AchievementTable}} which contain a custom caption. The template includes a series of sortable columns, so upon transclusion, any custom caption added after the template will follow the columns. On standard wikitables, there is no difference if the caption is listed before or after the columns in the table design. However, in sortable wikitables, the addition of a caption after the columns causes the sorting functionality to break and the column and row dividers are missing too.
Can the code for sortable wikitables be updated to handle for caption after the columns, disregarding them from the sort? SFB 20:48, 23 August 2023 (UTC)
1 | 2 | 3 |
---|---|---|
a | b | c |
1 | 2 | 3 |
---|---|---|
a | b | c |
1 | 2 | 3 |
---|---|---|
a | b | c |
d | e | f |
1 | 2 | 3 |
---|---|---|
a | b | c |
d | e | f |
SFB 20:48, 23 August 2023 (UTC)
Only between table start and first table row.Jroberson108 (talk) 21:59, 23 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:
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)
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)
You are invited to join the discussion at Wikipedia:User scripts/Requests § Sortkeys in lists. {{u|Sdkb}} talk 15:40, 12 January 2024 (UTC)
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)
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)
| 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)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)