Help talk:Sortable tables/Archive 2
Can this be got working?
In the header, it would be nice if the sort thingies were just where they're not & not where they are. Jɪmp 08:32, 27 March 2008 (UTC)
Define column to be sorted by defaultwhen i have !Name!!Surname!!Height: Name is sorted by default. Now I'd like to have Surname sorted by default but still as the second column. Is it possible? --Subfader (talk) 20:35, 27 March 2008 (UTC)
function ts_makeSortable(table) { var firstRow; <b>var reverseSort = false; // flag indicating whether it should be reverse order var defaultSortAnchor = null; // anchor tag that is the sort control for the default sort column</b> if (table.rows && table.rows.length > 0) { if (table.tHead && table.tHead.rows.length > 0) { firstRow = table.tHead.rows[table.tHead.rows.length-1]; } else { firstRow = table.rows[0]; } } if (!firstRow) return; // We have a first row: assume it's the header, and make its contents clickable links for (var i = 0; i < firstRow.cells.length; i++) { var cell = firstRow.cells[i]; if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) { cell.innerHTML += ' <a href="#" class="sortheader" onclick="ts_resortTable(this);return false;"><span class="sortarrow"><img src="'+ ts_image_path + ts_image_none + '" alt="↓"/></span></a>'; <b>// if the class contains "defaultsort" then sort on this column if ((" "+cell.className+" ").indexOf(" defaultsort ") > -1) { // look for the "sortheader" anchor tag and use it as the sort control var cellChildren = cell.childNodes; for( var j = 0; j < cellChildren.length; j ++ ) { if( cellChildren[j].nodeName == "A" && cellChildren[j].className == "sortheader" ) { defaultSortAnchor = cellChildren[j]; } } // if the class contains "reverse" then do a reverse sort if ((" "+cell.className+" ").indexOf(" reverse ") > -1) { reverseSort = true; } }</b> } } if (ts_alternate_row_colors) { ts_alternate(table); } <b>// if we found a default sort anchor, then do the sort if( defaultSortAnchor != null ) { ts_resortTable( defaultSortAnchor ); if( reverseSort ) { ts_resortTable( defaultSortAnchor ); } }</b> }
Was this ever resolved? I would also like to define the column that is the default sort, but the above Slow - what method?Sorting 1,000 or so items is very slow (example: list of chess grandmasters). What method does the sorting use? Could it be faster? Bubba73 (talk), 22:35, 30 March 2008 (UTC)
static columnsIs there a way of disabling sorting on one or more columns? I see the static columns example but it's not ideal building it with two separate tables. Anyone? Cnbrb (talk) 21:50, 9 April 2008 (UTC)
Thanks - sometimes I have a table where a reader might want to sort (say) column 1 alphabetically but subsequent columns might not be something worth sorting (e.g. a notes column). Hiding the handles would be the kind of thing I was thinking of. Cnbrb (talk) 23:15, 9 April 2008 (UTC)
Requesting to view wikitable code for Help:Sorting#ExamplesI'd like to view the code for several examples used at Help:Sorting#Examples However, that page is protected from editing. Is there another location where the code is able to be viewed? Specifically, I would like to see the wikitable code for the very last example which should show how to correctly use the "sm=n" solution for forcing numerical sort. Quote:
Najevi (talk) 15:09, 20 April 2008 (UTC) Ha! Found the source code at http://meta.wikimedia.org/wiki/Help:Sorting#Examples | style="text-align:center;" |-3°C{{smn}} | style="text-align:center;" |7°C{{smn}} Najevi (talk) 15:21, 20 April 2008 (UTC) Only some of the numbers will sortIn the article International wheat production statistics, years 2002-1999 work fine, while years 1998-1996 don't sort correctly. Is there any way to fix this, or is this a known "bug"? Esn (talk) 04:49, 23 April 2008 (UTC)
Please help: Sortable table provides one round of correct sorting, another of incorrect sortingTry this: visit the birth control comparison table, and click the button to sort by "perfect use" rates, once. Only once. See the two "no data" items at the top, there? OK, now click it again: what's happening is that it is being sorted in a different way. I don't know the name for it, but if you look at the very top of the block of blue items in "perfect use", and start moving your eyes up line by line, you will see it go from 2 to to 20 to 26. Clearly it is being sorted in a way that make mathematical sense, but is useless for that table's intended comparison. Is there a way to make the sortable table not do this? Thanks! Whistling42 (talk) 02:45, 25 April 2008 (UTC)
Error on Mediawiki version ?On the help page says "This works in MediaWiki 1.9 and above", but on MediaWiki, the las version is: "2008-03-20: 1.12.0 quarterly release". So we should wait some month for 1.9 version, and all Mediawiki projects has a very unstable version!? —Preceding unsigned comment added by 190.18.45.41 (talk) 02:22, 14 May 2008 (UTC)
helpfulThis page was very helpful! thanxArdeshire Babakan (talk) 18:10, 24 July 2008 (UTC) Do not edit this copy?This is a copy of the master help page at Meta. Do not edit this copy. That is what I see at the top of the article Help:Sorting, followed by Edits will be lost in the next update from the master page. Yet I see that edits have been made to the copy and do not see any update. Is this an old out of date message? It confused me, because I first read the sort mode section (ignoring the top message out of habit) and read the "sm=n" and "m:Template:smn". I found smn does not work for me, so I look at meta:Help:Sorting , where smn mention has recently been removed. Does this mean this copy page is due an update? Also, at the very end I see: "In particular, both the Template:Smn and the sm=n trick do not work on Wikipedia." -84user (talk) 03:56, 5 October 2008 (UTC) Numeric sort testThis table should sort according to wikipedia's Help:Sorting but not according to according to meta:Help:Sorting (maybe because meta has removed the support for formats like 4.32×104). Today it does not sort properly.
This table should sort according to both wikipedia and meta, and do sort for me today:
-84user (talk) 03:56, 5 October 2008 (UTC) Sorting Negative NumbersSorting negative numbers seems to work when the ASCII hyphen/minus "-" (0x002D) is used. It seems that the problem may be caused by the Unicode Minus Sign "−" (0x2212). - Unimath (talk) 00:13, 11 October 2008 (UTC)
CenterHow do you make a box be placed in the center? — NuclearVacuum 23:52, 27 November 2008 (UTC) Max rows for sort = 50?
numeric sort with 1+ non-numeric elements doesn't work on firefox 3.0.4It seems that if there are one or more 'non-numeric' elements in an otherwise numeric column, then it does not sort properly in firefox 3 (I tested with 3.0.4 on windows xp). You can see this on the first 'numbers' table in the Help:Sorting page (with 'ghi' as one of the elements). Additionally, in IE6 and IE7, after the page first loads and you try to sort a table of the aforementioned description, a first click on the sort button will not properly sort the table. The second and subsequent clicks seem to work properly. You can also see this problem here: United States cities by crime rate by sorting by 'violent crime'. —Preceding unsigned comment added by Tfischer (talk • contribs) 20:51, 15 December 2008 (UTC) Could somebody take a look at this article?I am trying to merge some wrestling title articles per a AFD discussion. The problem I am having is with the autosorting (since I am merging articles that existed just for how long they held a title with a list of chronological champions, so there has to be a way to sort based on how long they held the title). I can't seem to get it working right now. The article is List of WWE Intercontinental Champions. Could somebody experienced with autosorting take a look at it for me? TJ Spyke 05:38, 21 December 2008 (UTC) Sorting diacritic lettersWhat is the correct sorting order for words and names with diacritic letters? Various languages using the Latin alphabet sort their diacritic letters differently. In Swedish for instance, Å, Ä and Ö are the final letters of the alphabet. I assume that words with diacricits should be sorted without them, but I can't find any wikipedia rule about this. In one help page ASCII is stated to be the sorting order for strings, but that would be a bit confusing since diacritics are not placed next to their "main" letters. Mad Greg (talk) 12:15, 28 December 2008 (UTC) Blank spaces treated as zeroI am struggling to find a solution to the sortable table at List of Calgary Flames draft picks that would allow the list to sort empty cells as being less than zero. I could use {{sort|-1| }} in each cell, but in a table of this size, it would introduce a massive amount of overhead. In fact, in testing that as a solution I found editing the table to be incredibly difficult as both IE and Firefox struggled to handle the amount of data. Unfortunately, using emdashes rather than blank cells only managed to completely break sortability. Does anyone have any suggestions on how to resolve this problem? Thanks, Resolute 23:54, 12 February 2009 (UTC) FilterableHi guys, is there a way to make tables in wikipedia filterable? Similar to this: http://mguglielmi.free.fr/scripts/TableFilter/filter-sort.htm --TheBigJagielka (talk) 00:10, 30 April 2009 (UTC) Synch this copy with the one on meta?This version of Help:Sorting lacks many good updates that have been made to meta:Help:Sorting. For example, the confusing business about "sm=n" has been removed from meta's copy. Should these differing versions be synchronized now? --fjarlq (talk) 09:51, 9 May 2009 (UTC)
Sorting with dates before 10,000 BCIt seems that the method for date sorting only works for dates after 10,000 BC. How do I make a sortable column for dates before that date? In the table in question, I have dates from before 10,000 BC until around 800 AD. As the table is still in preparation, I am not sure yet what the exact dates will be. Most likely I will not have any month/day information to sort though. bamse (talk) 02:56, 13 May 2009 (UTC) Filter OUT, not INWhat I'd like to see is a way to pick one cell and filter OUT every row with that value in that column. This should be repeatable (same or different columns), without adding back the items filtered out (until you click refresh or something). This way you could start with a large list and gradually remove items that fail one or another criteria, until you've got the list whittled down to just the items that are truly interesting. Ideally sorting would NOT interfere with this; it would simply sort the items you have not filtered out. —Preceding unsigned comment added by 74.166.109.199 (talk) 01:30, 21 May 2009 (UTC) The "Sorting the wikitext of a table" sectionI don't understand this section at all. What is it saying? Is there something wrong with the markup or is it supposed to look like that? Additionally, is it possible to create a table that is sorted by one of its columns by default? Shreevatsa (talk) 19:27, 25 May 2009 (UTC)
Clicking the Sort button jumps to top of pageDoes anyone know what is going on here? In this article, only the first five columns of the table in section 5 (history) are sortable. The last buttons cause a jump to the start of the page for some strange reason. --KarlFrei (talk) 09:53, 26 June 2009 (UTC)
sorts:
good code: {| class="wikitable sortable" border="1" |- ! A ! B |- | a | b |- | c | |} does not sort:
bad code (second last line is missing): {| class="wikitable sortable" border="1" |- ! A ! B |- | a | b |- | c |} bamse (talk) 10:58, 26 June 2009 (UTC)
JavaScript sentence poorly writtenAs of 26 June 2009 the first sentence under the JavaScript section is confusing and doesn't appear to be proper English:
Unjedai (talk) 14:57, 26 June 2009 (UTC) I'll try again. What is the above sentence trying to say? What is the point? Is it trying to say that the JavaScript necessary to make table sorting work is installed with MediaWiki 1.9 and above versions in the {{SERVER}}/skins-1.5/common/wikibits.js directory, and that, for example on Wikipedia the URL for that is http://en.wikipedia.org/skins-1.5/common/wikibits.js? Unjedai (talk) 18:25, 23 September 2009 (UTC)
Why is sort type not specified in column header?It would be much less error prone to specify the sort type in the column header itself (similar to class="unsortable"). I propose class="date|numeric|currency|string|unsortable" in the header template to override determining a sort order by parsing the first cell in the table. This would fix many, many sorting bugs due to some rows containing bad data, such as "", "123±5" or "15—17" not being seen as numeric. --IanOsgood (talk) 18:44, 5 July 2009 (UTC)
Why....?Why, on New Zealand firefighter referendum, 1995, does it sort some percentages funnily, particularly in the 'no' column? If someone could fix this or tell me how to fix it, I would be very appreciative.Adabow (talk) 01:50, 17 July 2009 (UTC) Need help with numerical sortingI want to sort for the "Size column, but can't get it to happen. Here's my table: {| class="wikitable sortable plainrowheaders" |+ Japanese serow conservation areas{{sfn|Ono|2000|p=145}} |- ! scope="col" colspan="2"|Name ! scope="col" rowspan="2"|Established ! scope="col" rowspan="2" data-sort-type="number"|Size<br />ha (acres) ! scope="col" rowspan="2"|[[Prefectures of Japan|Prefecture]](s) |- ! scope="col"|English ! scope="col"|Japanese |- !scope="row"|[[Shimokita Peninsula]] |''{{lang|ja|Shimokita Hantō}}'' |align="right"| {{dts|1981|04|}} |align="right" data-sort-value="37300"| {{convert|37300|ha|acre|abbr=values}} |align="left"|[[Aomori Prefecture|Aomori]] |- !scope="row"|[[Ōu Mountains|Kita-Ōu Mountains]] |''{{lang|ja|Kita-Ōu Sankei}}'' |align="right"| {{dts|1984|2|}} |align="right" data-sort-value="105000"| {{convert|105000|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Aomori *[[Akita Prefecture|Akita]] *[[Iwate Prefecture|Iwate]]}} |- !scope="row"|{{ill|ja|Kitakami Sankei|北上山地}} |''{{lang|ja|Kitakami Sankei}}'' |align="right"| {{dts|1982|7|}} |align="right" data-sort-value="41000"| {{convert|41000|ha|acre|abbr=values}} |align="left"|Iwate |- !scope="row"|[[Ōu Mountains|Minami-Ōu Mountains]] |''{{lang|ja|Minami-Ōu Sankei}}'' |align="right"| {{dts|1984|11|}} |align="right" data-sort-value="57700"| {{convert|57700|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Akita *Iwate *[[Yamagata Prefecture|Yamagata]] *[[Miyagi Prefecture|Miyagi]]}} |- !scope="row"|Asahi—[[Mount Iide|Iide]] Mountains |''{{lang|ja|Asahi—Iide Sankei}}'' |align="right"| {{dts|1985|3|}} |align="right" data-sort-value="122000"| {{convert|122000|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Yamagata *[[Fukushima Prefecture|Fukushima]] *[[Niigata Prefecture|Niigata]]}} |- !scope="row"|[[Mount Echigo-Komagatake|Echigo]]—[[Mount Nikkō-Shirane|Nikkō]]—[[Mount Mikuni (Gifu)|Mikuni]] Mountains |''{{lang|ja|Echigo—Nikkō—Mikuni Sankei}}'' |align="right"| {{dts|1984|5|}} |align="right" data-sort-value="215200"| {{convert|215200|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Fukushima *Niigata *[[Tochigi Prefecture|Tochigi]] *[[Gunma Prefecture|Gunma]] *[[Nagano Prefecture|Nagano]]}} |- !scope="row"|Kantō Mountains |''{{lang|ja|Kantō Sanchi}}'' |align="right"| {{dts|1984|11|}} |align="right" data-sort-value="79000"| {{convert|79000|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Gunma *[[Saitama Prefecture|Saitama]] *[[Tokyo]] *[[Yamanashi Prefecture|Yamanashi]] *Nagano}} |- !scope="row"|[[Minami Alps National Park|Minami Alps]] |''{{lang|ja|Minami Arupusu}}'' |align="right"| {{dts|1980|2|}} |align="right" data-sort-value="122000"| {{convert|122000|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Yamanashi *Nagano *[[Shizuoka Prefecture|Shizuoka]]}} |- !scope="row"|[[Hida Mountains|Kita Alps]] |''{{lang|ja|Kita Arupusu}}'' |align="right"| {{dts|1979|11|}} |align="right" data-sort-value="195600"| {{convert|195600|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Niigata *Nagano *[[Toyama Prefecture|Toyama]] *[[Gifu Prefecture|Gifu]]}} |- !scope="row"|Shirayama |''{{lang|ja|Shirayama}}'' |align="right"| {{dts|1982|2|}} |align="right" data-sort-value="53700"| {{convert|53700|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Toyama *[[Ishikawa Prefecture|Ishikawa]] *Gifu *[[Fukui Prefecture|Fukui]]}} |- !scope="row"|[[Suzuka Mountains]] |''{{lang|ja|Suzuka Sanchi}}'' |align="right"| {{dts|1983|9|}} |align="right" data-sort-value="14100"| {{convert|14100|ha|acre|abbr=values}} |align="left"|{{Flatlist| *[[Shiga Prefecture|Shiga]] *[[Mie Prefecture|Mie]]}} |- !scope="row"|[[Ibuki Mountains|Ibuki]]—[[Hira Mountains|Hira]] Mountains |''{{lang|ja|Ibuki—Hira Sankei}}'' |align="right"| {{dts|1986|3|}} |align="right" data-sort-value="67500"| {{convert|67500|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Gifu *Shiga *Fukui *[[Kyoto Prefecture|Kyoto]]}} |- !scope="row"|[[Kii Mountains]] |''{{lang|ja|Kii Sankei}}'' |align="right"| {{dts|1989|7|}} |align="right" data-sort-value="79500"| {{convert|79500|ha|acre|abbr=values}} |align="left"|{{Flatlist| *Mie *[[Nara Prefecture|Nara]] *[[Wakayama Prefecture|Wakayama]]}} |- !scope="row"|Shikoku Mountains |''{{lang|ja|Shikoku Sanchi}}'' |<!-- align="right"| -->{{TBA}} |<!-- align="right"| -->{{TBA}} |align="left"|{{Flatlist| *[[Tokushima Prefecture|Tokushima]] *[[Kōchi Prefecture|Kōchi]]}} |- !scope="row"|Kyushu Mountains |''{{lang|ja|Kyushu Sanchi}}'' |<!-- align="right"| -->{{TBA}} |<!-- align="right"| -->{{TBA}} |align="left"|{{Flatlist| *[[Ōita Prefecture|Ōita]] *[[Kumamoto Prefecture|Kumamoto]] *[[Miyazaki Prefecture|Miyazaki]]}} |- |} Section break
Please help! Curly Turkey (gobble) 08:00, 10 September 2013 (UTC) Single columnI isolated just that column, and now it is sortable. So something from the rest of the table is preventing the sorting of that column. That is as far as I have it got it so far.
{| class="wikitable sortable plainrowheaders" |+ Japanese serow conservation areas{{sfn|Ono|2000|p=145}} |- ! data-sort-type="number"|Size<br />ha (acres) |- |align="right" data-sort-value="37300"| {{convert|37300|ha|acre|abbr=values}} |- |align="right" data-sort-value="105000"| {{convert|105000|ha|acre|abbr=values}} |- |align="right" data-sort-value="41000"| {{convert|41000|ha|acre|abbr=values}} |- |align="right" data-sort-value="57700"| {{convert|57700|ha|acre|abbr=values}} |- |align="right" data-sort-value="122000"| {{convert|122000|ha|acre|abbr=values}} |- |align="right" data-sort-value="215200"| {{convert|215200|ha|acre|abbr=values}} |- |align="right" data-sort-value="79000"| {{convert|79000|ha|acre|abbr=values}} |- |align="right" data-sort-value="122000"| {{convert|122000|ha|acre|abbr=values}} |- |align="right" data-sort-value="195600"| {{convert|195600|ha|acre|abbr=values}} |- |align="right" data-sort-value="53700"| {{convert|53700|ha|acre|abbr=values}} |- |align="right" data-sort-value="14100"| {{convert|14100|ha|acre|abbr=values}} |- |align="right" data-sort-value="67500"| {{convert|67500|ha|acre|abbr=values}} |- |align="right" data-sort-value="79500"| {{convert|79500|ha|acre|abbr=values}} |- |<!-- align="right"| -->{{TBA}} |- |<!-- align="right"| -->{{TBA}} |- |} See: Please do not edit my sandboxes. Anybody can create their own. --Timeshifter (talk) 15:37, 10 September 2013 (UTC) Rowspan and colspan in table headersSee this section higher up: When I remove rowspan and colspan from the headers the problem is solved. See: Please do not edit my sandboxes. Anybody can create their own. --Timeshifter (talk) 15:37, 10 September 2013 (UTC)
{| class="wikitable sortable plainrowheaders" |+ Japanese serow conservation areas{{sfn|Ono|2000|p=145}} |- ! scope="col" colspan="2"|Name ! style="border-bottom:none" | <!-- Top half of the "Established" header --> ! style="border-bottom:none" | Size ! style="border-bottom:none" | <!-- Top half of the "Prefectures" header --> |- ! scope="col"|English ! scope="col"|Japanese ! scope="col" style="border-top:none"|Established ! scope="col" style="border-top:none" data-sort-type="number"|ha (acres) ! scope="col" style="border-top:none"|[[Prefectures of Japan|Prefecture]](s)
Sorting not working with complex headersCould someone please help fix a sorting issue on List of A-League honours#Summary. When you click to sort a table, it sorts the one on the left rather than the one you clicked and I'm not sure how to fix the issue. Help would be much appreciated. --2nyte (talk) 05:57, 18 April 2013 (UTC)
(unindent). I think I figured it out a little bit. Help:Sorting needs a separate section just for getting sorting to work with complex headers. There is no such section now. Maybe I will get around to it someday. Plastikspork, I think this is what you are talking about:
{| class="wikitable sortable" border="1" |- ! style="border-bottom:none" | ! colspan=2 |Data columns |- ! style="border-top:none" |name ! data ! more data |- | cats | 273 | 53 |- | dogs | 65 | 8,492 |- | mice | 1,649 | 548 |} The key is that there are no rowspans used in the headers. This is done by giving the appearance of rowspan without actually using rowspan in the headers. CSS styling is used to hide the border between 2 cells, and thus make them look like one cell spanning 2 rows. CSS styling:
--Timeshifter (talk) 09:08, 25 April 2013 (UTC)
(unindent). Here is the same chart, but using rowspan too:
When the bugzilla:38911 fix is implemented the above chart will sort correctly. --Timeshifter (talk) 19:53, 12 June 2013 (UTC) This second example (by using rowspan) does not work correctly when there is one or more columns right to the row/colspan group of columns:
In Firefox 24.0, the first column "name" runs properly; "data" sorts "more data"; "more data" sorts "Another column"; and "Another column" sorts "data". Sorry but bugzilla:38911 hasn't be fixed very well. –pjoef (talk • contribs) 15:55, 5 October 2013 (UTC)
Sortable tableWhen I use the Sortable table on the Welsh Wikipedia, the English title "Sortable table" hovers heavily above it. This is unnecessary, even in English imho; certainly unnecessary in every other language. How do I get rid of it please? For example: A list of Welsh Literary Books published since 1996. - Llywelyn2000 (talk) 23:16, 16 October 2013 (UTC)
Adding mid-stream or floating headersIt would be nice to have some way, for long tables with several columns, to repeat the header, or have it floating when you scroll down, or *something*, without having to disable sortability or end up with all the spare headers bunched together if you sort. Is there any way to do this? Several basic approaches I can imagine: 1. have a way to basically say "ignore this line when you're sorting, this is row 20 regardless of what goes on around it" or the like 2. have a way to make a table automatically spit out a "header" line every 20 rows (or whatever) 3. use framing or the like to have a "floating" header line that stays visible when you scroll past the header This is particularly a problem for the "vampire traits" page. It has *huge* tables, mostly consisting of columns with entries like "yes", "fatal", "no", and the like. Tamtrible (talk) 00:52, 11 July 2013 (UTC)
Sorting problem with complex table captionI've been working for more than an hour with edit previews to make the table at Template:Boxer Rebellion sortable, but it's not working! The problem seems to come from the complex table caption, which contains the table title, an image file, and an image caption. Three different things happen depending on what code I use to introduce the table caption:
Here's my table for the third example: {| class="wikitable sortable" border="1" align="right" style="margin-left: 1em; text-align:right;" |- ! colspan="4" align="center" cellspacing="0" | '''Forces of the [[Eight-Nation Alliance]]<br/> <small>Relief of the [[Beijing Legation Quarter|Legations]]</small>'''<br />[[File:Troops of the Eight nations alliance 1900.jpg|300px]]<br /><small><center>Troops of the Eight-Nation Alliance in 1900.<br />Left to right: Britain, United States, Australia<ref>[http://www.4808.info/html/2008-05/4469p2.html Example of Australian uniform of the period]</ref>, British India,<br /> Germany, France, Austria-Hungary, Italy, Japan</center></small> |- ! align=center | '''Countries''' ! align=center | '''Warships'''<br/> <small>(units)</small> ! align=center | '''Marines'''<br/> <small>(men)</small> ! align=center | '''Army'''<br/> <small>(men)</small> |- |[[Empire of Japan|Japan]] |18 |540 |20,300 |- | [[Russian Empire|Russia]] | 10 | 750 | 12,400 |- | [[British Empire|United Kingdom]] | 8 | 2,020 | 10,000 |- | [[French Third Republic|France]] | 5 | 390 | 3,130 |- | [[United States]] | 2 | 295 | 3,125 |- | [[German Empire|Germany]] | 5 | 600 | 300 |- | [[Austria–Hungary]] | 4 | 296 | |- | [[Kingdom of Italy (1861–1946)|Italy]] | 2 | 80 | |-class="sortbottom" | '''Total''' | 54 | 4,971 | 49,255 |} I'm not competent enough with tables to figure this out, so I'd be very grateful for your help!
Table with more complex headersSee section higher up: #Sorting not working with complex headers. I copied this table from that section so as to focus discussion.
I read that there is a patch being reviewed that may fix this. See comment 8 in bugzilla:38911: "Timeshifter, patch for bug 53211 – https://gerrit.wikimedia.org/r/#/c/98250/ – should fix that as well." So when this table works, that means the patch code has been installed. --Timeshifter (talk) 08:07, 9 December 2013 (UTC)
class=sortkeyI use Can't get simple table to sortAt List of largest lakes and seas in the Solar System, I specified that the columns were to sort by "number", and set the data-sort-value for individual cells (with and without commas in the values), but I can't get the table to sort numerically. What am I doing wrong? — kwami (talk) 19:24, 24 April 2014 (UTC)
Chinese language names sortingCan anyone direct me to an explanation of the Chinese language name sorting defaults used in 'wikitable sortable'? This is in connection with the article List of power stations in China (for example Coal). Thank you. Kleinzach 07:33, 8 May 2014 (UTC) Weird purple "unsortable" table for sortableCan someone please check List of Indian states and territories by highest point. Am I the only one seeing the first table as an unsortable and purple colored? The second table is working fine for me. If others are not facing this problem, any idea why I could be having it? Thanks. Ashinpt (talk) 09:34, 19 June 2014 (UTC)
Table not sorting at List of awards and nominations received by Game of ThronesWhen I click one of the headers, the year column breaks into individual lines but nothing else happens. I'm on Chrome. Darkwarriorblake / SEXY ACTION TALK PAGE! 20:42, 10 July 2014 (UTC)
Sorting is working for me in Firefox and Internet Explorer (I don't have Chrome) in this revision of the table: Let us check the easy stuff first. Do the previous posters have problems with complex headers? From Help:Sorting: Section titled: "Tables with complex headers": Supposedly, people should no longer have a problem with this table below. Sorting is working for me. Is it working for you?
If that table sorts for you, then the next step is figuring out what is happening farther down in the table in question. I am just trying to get a base line of what is working for all of us. --Timeshifter (talk) 13:52, 12 July 2014 (UTC)
Which algorithm is used?Which algorithm is used by the Wikimedia software to sort sortable tables? This question seems to be not of interest concerning practical uses, but it determines wether the sort is stable (when I have understood the term "stability" in algorithm theory correctly), and finally, it influences the user experience (a stable sorting algorithm would allow him to easily sort by various criteria simultaneously). — Preceding unsigned comment added by 2003:45:CB20:E622:3D7B:4EA5:BF9B:189E (talk) 19:47, 23 September 2014 (UTC)
Date sort apparently only working in ChromeI have what I think is a fairly simple sortable table, Table of models with four sortable columns, two number and two date. All work fine in Chrome v37 on both Win7 (64 bit) and WinXP but the date columns don't sort in IE8/XP, IE11/Win7 or Firefox 31. The first column, Date, sorts fine in all systems. I'm thinking about going to data-sort-type="number" and using embedded sort values as a work around. Anyone else have the same problem? Any help would be appreciated? Tom94022 (talk) 21:51, 9 October 2014 (UTC)
A correct table forbidden?The help page now says: "Avoid rowspan in body of table". I find this a bit too strong. As we know, these days the rowspan is undone when a reader clicks a sortbutton (the table is turned into single-rows only with repeated cellcontent: all correct). Indeed, adding rowspan is a complicating, but I don't see why it should be "avoided" (no exception mentioned!). First of all, adding rowspan can be desirable before any sorting comes in play. It is a basic table feature. Second, using rowspan and sorting correctly, why not? The "avoid" 'advice' (actually to be read as a MOS guideline) does not prove that is causes errors or a wrong reader experience. I suggest the wording is changed. There could be a warning in there, but not a scare. And to be clear, I am not planning to undo the pages where I applied rowspan in a sortable. -DePiep (talk) 08:34, 17 October 2014 (UTC)
Heading background color on sortable tablesT33775 I'm building the List of mammals of Oregon which currently has sortable tables with a background color, but it does not have the arrows pointing up and down in the column header, like most of the other sortable tables do. Header with color background example:
Header with arrow but no color example:
Is there a way to have both the arrows and the background color? —Gaff ταλκ 21:29, 25 October 2014 (UTC) I did not find a solution either. I sometimes use this compromise:
Thank you. Somebody at the Help Desk showed me a solution and I came up with this:
—Gaff ταλκ 01:46, 26 October 2014 (UTC)
Colspan still unsortable?Hello, I was trying (on the French Wikipedia) to create sortable tables with both "rowspan" and "colspan" attributes. As it wasn't working I tried tables with "rowspan" or "colspan" only. The first ones are working well, but none of the tables with "colspan" do. After some research (including information on this page) I found that "colspan" was still preventing sortable tables to work well. I'd like to know if there has been any improvement regarding this issue lately, and if not why this bug page was closed in Bugzilla while "colspan" is still breaking table sorting. Encolpe (talk) 08:15, 14 October 2014 (UTC)
Hi! I created a new Bigzilla Report, still unsuccessfully so far ;) Encolpe (talk) 08:02, 2 November 2014 (UTC) Tables with complex datarowsDePiep. You can reword stuff, but not wholesale remove whole sections as you did here. Not without discussion. We already changed the title as you requested. --Timeshifter (talk) 13:04, 10 November 2014 (UTC)
CleanupI am performing some technical cleanup. Some issues:
-- Gadget850 talk 13:21, 10 November 2014 (UTC)
Question on sorting
In a sortable table like the above one, when you click on any column's header to sort by that column's contents the contents of the cells of the first column will be split and doubled. Is there any way to code such a table that it only splits if you sort on the second column and that if you sort back on the first column after having sorted on the second column the cells that were split in two are merged again to their original state? Tvx1 02:20, 1 March 2015 (UTC)
Similar problem on sortingI have a similar problem as the one inquired above. When I sort that table in my Sandbox, Moszkowski's Op. 3 for instance, appears with Title, Opus number and Year displayed in four lines, not in one, the way it should be. The same happens with every composition containing more than one movement or key. How could I solve this problem and display Title, Opus and Year without doubling ? Krenakarore TK 23:05, 23 March 2015 (UTC)
Nonsensical sorting by yearWhen you sort this table by year http://en.wikipedia.org/wiki/United_Nations_list_of_Non-Self-Governing_Territories#Change_in_status_by_administrating_state the order is complete nonsense! There isn't any logic to it! WTF? Oh and yet the sorting works perfectly right in the editing preview, just not when it's saved. Still can't sort properly. In 2015... --178.0.100.7 (talk) 11:45, 13 April 2015 (UTC)
Default numerical sortingCan anyone explain to a markup-challenged individual (me) why numerical list/columns default to sorting by the first digit, rather than by whole numbers? I can't think of many situations in which such a default is useful. Is this, perhaps, an unintended side-effect of alphabetical sorting? There are quite a few broken tables out there as a result, and I (for one) find the instructions for using data-sort-type="number" difficult to follow, to say the least. I don't know how difficult to implement this would be, but: it would save a lot of work if the in-built default sorting of digits worked differently to that of alphabetical characters. Grant | Talk 05:24, 1 June 2015 (UTC)
Targets table refusing to sortCould someone possibly have a look at what's gone wrong with the tables here (under Target seats)? The final four columns to the right sort fine in preview mode but they refuse to sort properly on the article itself. —Nizolan (talk) 23:13, 11 May 2015 (UTC)
Conservative Party
I removed all the rowspans and colspans. I cleaned the table up further by removing all the sort templates. They were unnecessary. All the columns sort correctly. --Timeshifter (talk) 22:42, 15 May 2015 (UTC)
Row filtering & Multiple sort fieldsIs there any way to add filters on row headers to only show some of the rows in a given table. I understand that this is not trivial as it requires to adapt to each data types and to provide a minimal boolean function, but that would be a (very) nice addition to sortable tables. Along the same way it would be nice to allow sorting on multiple columns (A then B, then C). knd (talk) 09:10, 12 June 2015 (UTC)
Numerical sorting questionI am currently working on this table. After reading the advice in this page, my understanding is that it is impossible to have the cells containing numbers sorted first, with blank/NA/- cells following afterwards. Is that correct? AtHomeIn神戸 (talk) 05:35, 23 July 2015 (UTC) Updated link since page has been moved. AtHomeIn神戸 (talk) 02:04, 2 September 2015 (UTC) |