Jump to content

Help talk:Sortable tables

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 94.195.252.155 (talk) at 20:24, 13 December 2009 (Help with Alternating Colours Feature: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconWikipedia Help NA‑class
WikiProject iconThis page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the Help Menu or Help Directory. Or ask for help on your talk page and a volunteer will visit you there.
NAThis page does not require a rating on the project's quality scale.

Reverse order sort

How do I reverse order sort based on the order of the items in the list? I want to reverse the order of the items irrespective of date, currency, numeric, or string, but only by how the items first appear on the list. XP1 (talk) 23:54, 12 April 2009 (UTC)[reply]

Date sorting improvements

wikibits.js can be improved to include more date formats and trim leading/trailing spaces from dates. I've taken a stab at a couple of improvements outlined below

  • Dates of the form "DD MMM YYY" can also look like "DDMMMYYYY". This can be fixed by changing the line
       if (/^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/.test(itm)) {

to

       if (/^\d\d[\/. -]?[a-zA-Z]{3}[\/. -]?\d\d\d\d$/.test(itm)) {
  • Dates should be trimmed before sorting dates of the format "DDMMMYYYY" should be sorted

Add the following before the first line of "ts_dateToSortKey"

       date= date.replace(/^\s\s*/, ).replace(/\s\s*$/, );
       if (date.length ==9){
               date = date.substr(0,2)+" " + date.substr(2,3)+" "+ date.substr(5);
       }

--Bala (talk) 19:30, 20 March 2009 (UTC)[reply]

Possible improvement for Template:Dts

I saw that {{Dts}} was copied from m:Template:Dts. Help:Sorting is pretty cool stuff. But since I'm a lazy programmer and wikieditor, I'm always looking for a way to cut corners. Check out {{User:MrDolomite/Sandbox/Dts}} and let me know what you all think. — MrDolomite | Talk 18:04, 11 January 2007 (UTC)[reply]

It's caused a couple problems already, and we have the opportunity to fix them before it gets used everywhere and there's lots of fixin' to do. Check out Template Talk:Dts for more. —Wikibarista 18:04, 21 March 2007 (UTC)[reply]

Sort key

Is it possible (or would it be possible) for cells to have a sort key different from that which is displayed? I want to make List of Liverpool F.C. players sortable, but for it to be useful I really need:

  • To sort the names by surname, firstname
  • To sort the flag icons by nation name
  • To sort the positions in the order of (roughly) GK, Defender, Midfielder, Forward.

--ArtVandelay13 13:19, 11 February 2007 (UTC)[reply]

No, sorry, that is not possible right now. The obvious solution to issue #1 is to make the displayed text itself in Last, First format. The obvious solution to issue #2 is to convey the information in words rather than with an image. Christopher Parham (talk) 23:47, 12 February 2007 (UTC)[reply]
Perhaps the best solution for sorting by images (e.g national flags) is to have images be sortable by alt text. Pimlottc 01:46, 13 February 2007 (UTC)[reply]
Please check out the discussion underway at Template talk:Sortname. You can use {{sortname}} today to solve the first problem, and {{sort}} or {{sortkey}} to solve the other two. Andrwsc 00:24, 5 April 2007 (UTC)[reply]

colspan=2

The script, while ingenious, doesn't work very well with headers spanning over several columns, effectively screwing up List of members of the Riksdag, 2002-2006 by requiring a separate header for the colors (resulting in that column being unnecessarily wide). Solution, anyone? Jobjörn (Talk ° contribs) 21:03, 22 February 2007 (UTC)[reply]

2 1/2 years later and this is still an issue?—NMajdantalk 04:45, 4 October 2009 (UTC)[reply]

Tables not being sorted

For some reason I'm no longer able to get tables in WP to obey the instruction class="wikitable sortable". Is this a known problem? JavaScript is not disabled on my system.

It must be something to do with my WP Preferences, because the problem disappears when I log out. I don't remember changing anything in the Prefs, however: any suggestions? I've tried bypassing my cache, but that didn't help.

What would I need to do (or have done) to disable the "sortable" property on my computer? -- NigelG (or Ndsg) | Talk 09:41, 13 March 2007 (UTC)[reply]

PS What I really meant is: the buttons don't appear at the top of the columns. When I log out they do appear, & the table sorts correctly. -- NigelG (or Ndsg) | Talk 17:54, 13 March 2007 (UTC)[reply]
It's OK: I've got to the root of the problem, which was in my monobook.js. Panic over! -- NigelG (or Ndsg) | Talk 18:06, 14 March 2007 (UTC)[reply]
I get exactly the same problem. If I'm logged in then "sortable" just seems to be ignored. If I log out or empty my monobook.js then it works. Does anybody have more information on what we need to fix in monobook.js to get sortable tables to work.--MarkS(talk) 07:16, 7 April 2007 (UTC)[reply]
Found the problem. I use the Extra Edit Buttons script. This had a function with the name getElementsByClassName which prevented sortable tables from working. I guess, therefore, that the sortable script also has the same function name. I've change extra edit buttons to use a different name. I guess though that other scripts could also include a function with this name so watch out. --MarkS(talk) 21:10, 7 April 2007 (UTC)[reply]
Same problem here, but no matter what I disable in my preferences or remove from my monobook.js, the problem is still there. Any suggestions? --Addingrefs ( talk | contribs ) 17:43, 1 January 2009 (UTC)[reply]
Note: Tables are sorted when I log out, but when I log in it just jumps to the top of the page. --Addingrefs ( talk | contribs ) 17:47, 1 January 2009 (UTC)[reply]

Sortkeys

I started a discussion at Template talk:Sort, since there seem to be a number of unconnected efforts to create sortkeys for sortable wikitables. ~ trialsanderrors 23:21, 2 April 2007 (UTC)[reply]

number sorting

I've read this page and looked at the code in the example table, but I don't quite get what is the best way to get numbers of varying lengths to sort properly (i.e. for 17,000,000 to show up as larger than 900,000). In particular, I would like to fix the attendance numbers at List of sports attendance figures. Thanks for any help. — Reinyday, 00:15, 5 April 2007 (UTC)

Try the {{nts}} template! You would write {{nts|17000000}} to render 17,000,000, and the sort keys would work as expected. Andrwsc 00:22, 5 April 2007 (UTC)[reply]
  • Excellent. Thanks! — Reinyday, 19:03, 6 April 2007 (UTC)

<datagrid>?

Do you plan to ultimately use datagrid?
David Latapie ( | @) — www 19:35, 10 April 2007 (UTC)[reply]

help

I need the correct code for Instructions_per_second anywere can help? -- FidelFair 04:13, 6 May 2007 (UTC)[reply]

Processor IPS (sortable don´t work?) Year Source
Pencil and Paper 0.0119 IPS 1892 [1]
IBM System/370 model 158-3 1 MIPS 1972
Intel 8080 640 kIPS at 2 MHz 1974
VAX 11/780 500 kIPS 1977
Motorola 68000 1 MIPS at 8 MHz 1979
Intel 386DX 8.5 MIPS at 25 MHz 1988
Intel 486DX 54 MIPS at 66 MHz 1992
PowerPC 600s (G2) 35 MIPS at 33 MHz 1994
Intel Pentium Pro 541 MIPS at 200 MHz 1996 [2]
ARM 7500FE 35.9 MIPS at 40 MHz 1996
PowerPC G3 525 MIPS at 233 MHz 1997
Zilog eZ80 80 MIPS at 50 MHz 1999 [3]
Intel Pentium III 1354 MIPS at 500 MHz 1999
AMD Athlon 3561 MIPS at 1.2 GHz 2000
AMD Athlon XP 2400+ 5935 MIPS at 2.0 GHz 2002
Pentium 4 Extreme Edition 9726 MIPS at 3.2 GHz 2003
ARM Cortex A8 2000 MIPS at 1.0 GHz 2005 [4]
Xbox360 IBM "Xenon" Triple Core 6400 MIPS at 3.2 GHz 2005
AMD Athlon FX-57 12000 MIPS at 2.8 GHz 2005
AMD Athlon 64 3800+ X2 (Dual Core) 14564 MIPS at 2.0 GHz 2005 [5]
AMD Athlon FX-60 (Dual Core) 18938 MIPS at 2.6 GHz 2006 [6]
Intel Core 2 X6800 27079 MIPS at 2.93 GHz 2006 [7]
IBM Cell one SPE 25600 MIPS (MFLOPS) at 3.2 GHz 2006
IBM Cell one PPE 51200 MIPS (38400 MFLOPS)at 3.2 GHz 2006
IBM Cell BE (1PPE + 8SPEs) 256000 MIPS (MFLOPS) at 3.2 GHz 2006
SONY PS3 (1PPE + 7SPEs) 230400 MIPS (217600 MFLOPS) at 3.2 GHz 2006
Intel Core 2 Extreme QX6700 57063 MIPS at 3.33 GHz 2006 [8]
This seems to work:
Processor IPS Year Source
Pencil and Paper 0.0119 IPS 1892 [9]
IBM System/370 model 158-3 1 MIPS 1972
Intel 8080 640 kIPS at 2 MHz 1974
VAX 11/780 500 kIPS 1977
Motorola 68000 1 MIPS at 8 MHz 1979
Intel 386DX 8.5 MIPS at 25 MHz 1988
Intel 486DX 54 MIPS at 66 MHz 1992
PowerPC 600s (G2) 35 MIPS at 33 MHz 1994
Intel Pentium Pro 541 MIPS at 200 MHz 1996 [10]
ARM 7500FE 35.9 MIPS at 40 MHz 1996
PowerPC G3 525 MIPS at 233 MHz 1997
Zilog eZ80 80 MIPS at 50 MHz 1999 [11]
Intel Pentium III 1354 MIPS at 500 MHz 1999
AMD Athlon 3561 MIPS at 1.2 GHz 2000
AMD Athlon XP 2400+ 5935 MIPS at 2.0 GHz 2002
Pentium 4 Extreme Edition 9726 MIPS at 3.2 GHz 2003
ARM Cortex A8 2000 MIPS at 1.0 GHz 2005 [12]
Xbox360 IBM "Xenon" Triple Core 6400 MIPS at 3.2 GHz 2005
AMD Athlon FX-57 12000 MIPS at 2.8 GHz 2005
AMD Athlon 64 3800+ X2 (Dual Core) 14564 MIPS at 2.0 GHz 2005 [13]
AMD Athlon FX-60 (Dual Core) 18938 MIPS at 2.6 GHz 2006 [14]
Intel Core 2 X6800 27079 MIPS at 2.93 GHz 2006 [15]
IBM Cell one SPE 25600 MIPS (MFLOPS) at 3.2 GHz 2006
IBM Cell one PPE 51200 MIPS (38400 MFLOPS)at 3.2 GHz 2006
IBM Cell BE (1PPE + 8SPEs) 256000 MIPS (MFLOPS) at 3.2 GHz 2006
SONY PS3 (1PPE + 7SPEs) 230400 MIPS (217600 MFLOPS) at 3.2 GHz 2006
Intel Core 2 Extreme QX6700 57063 MIPS at 3.33 GHz 2006 [16]
Enjoy. —EncMstr 19:56, 7 May 2007 (UTC)[reply]
thx --FidelFair 09:20, 8 May 2007 (UTC)[reply]

collapsable + sortable?

Is it possible to get a collapsable and sortable table? ∞ΣɛÞ² (τ|c) 12:30, 26 May 2007 (UTC)[reply]

Header 1 Header 2 Header 3
A1 B1 C1
A2 B2 C2
Apparently. --Van helsing 09:29, 30 May 2007 (UTC)[reply]
Collapsible table
Header 1 Header 2 Header 3
A1 B1 C1
A2 B2 C2
or tables in tables.

Numeric sorting doesn't work

I've made a sortable wikitable for a "crimes against humanity" table, here, but I couldn't get the estimates columns to sort properly. I know what the problem is in part, which is that because there are references together with the estimates in the first cell, the sort table reads as an alphabetic table instead of a numeric one.

The Help page says you just have to finish your cell with the code "sm=n" to make the sorting in such cases numeric, but it doesn't work. I found another way of making the table work by creating hidden rows at the top and bottom of the table with very high and low numbers respectively, but it's a kludgy fix and doesn't work right under all conditions.

Can someone please show me how to get this "sm=n" method to work? Thanks, Gatoclass 16:45, 15 June 2007 (UTC)[reply]

It requires the relevant code in m:MediaWiki:Common.js to be copied to MediaWiki:Common.js.--Patrick 23:04, 17 June 2007 (UTC)[reply]
Do you know how to do that? I have no idea. Gatoclass 23:14, 17 June 2007 (UTC)[reply]
It is not difficult to do (for a sysop like me) but it requires consensus. You can propose it at MediaWiki talk:Common.js. Even better for maintainability is that such changes are made in wikibits.js. You can support my proposal to allow negative numbers and other features at bugzilla:8115.--Patrick 08:12, 18 June 2007 (UTC)[reply]
It appears that the "sm=n" method was proposed to fix this problem, but never actually implemented. bugzilla:13535 was filed asking for the "sm=n" support, but that solution was rejected in favor of finding a better general syntax, which is being discussed in bugzilla:15406. --fjarlq (talk) 09:09, 9 May 2009 (UTC)[reply]

Not sorting properly

I have added the sm=n to the List of Aston Villa F.C. players article but the goals and appearances sections are still not listing properly. For the appearances section anyway it seems to be those numbers that are under 100. Can anyone help? Thanks Woodym555 14:11, 4 August 2007 (UTC)[reply]

Fixed now. I needed the nts template. Woodym555 18:22, 5 August 2007 (UTC)[reply]

Generic sorting template?

This question was moved here from the "Wikipedia-specific help" section in the help page:

I am trying to create number parameters for sorting. (Ex. sorting_table|table1|5|10, 5 being the number of rows and 10 being the number of colums). Is that even possible? I would like to be able to add or remove rows so a generic sorting template can be used for many different articles. The articles will have similar information but different names.

-- Ricky.Garcia 16:50, 7 August 2007 (UTC)[reply]

All demos work on meta but some fail on this copy

I just thought I should point out that as of time of writing some of the examples don't work in this version of the page (the initial sort is incorrect although second and subsequent sorts are correct) although they do on the meta original, so I guess something needs updating. --80.175.250.218 08:53, 9 August 2007 (UTC)[reply]

Sorting not functioning correctly

Can someone please look at the table here and check why the goal difference column does not sort correctly? Thanks in advance. Madcynic 10:06, 7 October 2007 (UTC)[reply]

Sorting a column with negative numbers works on Meta, where a bug was fixed, but the developers have not fixed it yet for MediaWiki in general (bugzilla:8115), and changes in MediaWiki:Common.js raise concerns about maintainability of the code. Anyway you would have to use a regular hyphen as minus sign. See also the version of the help page applicable without modifications of the JavaScript for workarounds.--Patrick 11:05, 7 October 2007 (UTC)[reply]

Another sorting anomoly

Hi! I recently created my first table, which a fellow editor converted to a sorting table. Problem is, we're seeing different things when we click the sort buttons! He's getting proper sorting in all columns, while only the first column sorts (ascending/descending) for me—regardless of which column's header I click on. Why would that be? The page in question is Wikipedia:WikiProject_Birds/Country_lists. I'm on Mac OSX10.4.10, using Safari. Help! MeegsC | Talk 13:10, 6 November 2007 (UTC)[reply]

I heard that before, I added that at m:Help:Sorting#Browser_issues.--Patrick 13:52, 6 November 2007 (UTC)[reply]
Safari/Webkit hasn't had this problem for a while now. Prominent mention this past problem may now seem to be disinformation. --dvdrtrgn (talk) 17:24, 2 October 2008 (UTC)[reply]

Hide someting

Hi,

I would like to know if it's possible to hide something in a sorting table.

Ex:

How I can sort byu last name

Name
Bob Dubois
Roger Smith
Frank Desmarais

Thank! Riba en (talk) 20:10, 9 December 2007 (UTC)[reply]

See Template:Sortname.--Patrick (talk) 00:37, 10 December 2007 (UTC)[reply]

Date sorting not working properly - please help

Could anyone tell me why this table is not sorting properly? We want to be able to sort by date. Various people over here have said that the sorting does not work for them. Thank you, Fang Aili talk 03:41, 16 December 2007 (UTC)[reply]

User Name Date of Original Request Last date page visited Wiki areas of interest Article areas of interest Requestor comments Contact log/Notes
Robotam (talk · contribs) 31 July 2004 Been active for some time, I believe I have given positive contributions, but I want to make sure I have not developed "tunnel vision." I would definitely appreciate wiki mentoring to do even more, and do it the right way.RoBoTamice 20:29, 31 July 2007 (UTC)[reply]
Lemonflash (talk · contribs) 1 August 2007 I'm an active contributer to Wikipedia, and wish to be an admin some day. Lemonflashtalk 01:03, 1 August 2007 (UTC)[reply]
Andyroo g (talk · contribs) 25 July 2002 I have wanted to be an admin for some time now, and would like to get some training to do so. I realise it is cliched, but i do truly have a misleadingly low edit count compared to my true amount of edits as a result of a large amount of edits whilst not signed in Andyroo g 18:46, 25 July 2007 (UTC)[reply]
Violask81976 (talk · contribs) 20 July 2007 Want some guidance. -Violask81976 15:15, 20 July 2007 (UTC)[reply]
geniussansom (talk · contribs) 16 July 2001 Would like some guidance on expanding the articles which I edit and would like to be an admin at some point in the future --geniussansom 15:34, 16 July 2007 (UTC)[reply]
Someguy1221 (talk · contribs) 11 July 2007 Looking to be an admin, and I think I might need some advice. Someguy1221 08:47, 27 April 2007 (UTC). Still interested. Someguy1221 07:08, 11 July 2007 (UTC)[reply]
Flubeca (talk · contribs) 10 July 2009 I want to become an admin :) -FlubecaTalk 19:02, 10 July 2007 (UTC)[reply]
Son (talk · contribs) 9 July 2007 I've been on en.wikipedia since December 2005 with some IP editing before that, and I'd like to become an admin. I definitely need some improvement, and I've gotten more invovled in XfDs and RfCs. --myselfalso 19:22, 9 July 2007 (UTC)[reply]
Nwwaew (talk · contribs) 23 June 2000 I want to see what I'm doing right, and what I need to improve to become an admin, and stand a chance at WP:RfA. This is what I think is the best course of action. Nwwaew (Talk Page) (Contribs) (E-mail me) 13:39, 23 June 2007 (UTC)[reply]
It's working exactly as it should: lexicographically. It sorts by day month year because that's the order you've written them. If you want to sort by date, write the dates as 2007-07-09 for example. Somewhere there's a template which displays one thing but sorts by another value. I'll look for it. —EncMstr 03:48, 16 December 2007 (UTC)[reply]
It appeared from the example on Help:Sorting that dates could be sorted without having to put them in the YYYY-MM-DD format. But I could not figure out what it was, or if I was misunderstanding completely. --Fang Aili talk 03:51, 16 December 2007 (UTC)[reply]
Use this instead: {{dts}}. Use it as {{dts|day|month|year}} in place of the date values. It produces an invisible sortable date and displays it formatted correctly according to user preferences. —EncMstr 03:54, 16 December 2007 (UTC)[reply]
Thanks, EncMstr. It looks like {{dts}} is my best bet. I really dislike introducing useless wikidate links, though. --Fang Aili talk 04:17, 16 December 2007 (UTC)[reply]
Don't think of them as links. Think of them as variables. That way I can see dates formatted the way I expect, and you can see what you expect via your preferences. —EncMstr 05:17, 16 December 2007 (UTC)[reply]

Sorting column with any negative numbers

When I have a column with a negative number, it sorts ok ascendingly, but sorts alphabetically descendingly. Is this a javascript problem? I've tried so many suggestions - none have worked --JimWae (talk) 08:30, 24 December 2007 (UTC)[reply]

Date sorting (day/month)

I was hoping to use dates in a sortable table without specifying the year (i.e. 1 January), but I can't figure out how to do it and get the table to sort properly. I tried {{Dts}}, but year seems to be a requirement. Any help would be appreciated! PC78 (talk) 21:21, 22 February 2008 (UTC)[reply]

Rows/headers above sortable row

I'd like to add a header above the sortable row on the table in the Statewide polling article. Basically, above the first Clinton/Obama/Other columns I'd like to add a "Polling data" column (with colspan="3") and above the second Clinton/Obama/Other columns I'd like to add a "Delegates won" column (with colspan="3"). The "Date", "State", and "Delegates" column would ideally be modified to have rowspan="2". Can anyone help me do this? Andareed (talk) 22:28, 8 March 2008 (UTC)[reply]

Sorting numbers

Clicking the sort button messes up this table by sorting the numbers by digit rather than by number. How do I make it recognize that 10 is bigger than 2? Is there a parameter that makes it look at numbers differently? Thanks. --Arctic Gnome (talkcontribs) 04:50, 20 March 2008 (UTC)[reply]

Number of years
1 year
2 years
5 years
10 years
20 years
25 years
Never mind. I solved it by adding invisible zeros. I even found a template that does it for me: {{0}}. --Arctic Gnome (talkcontribs) 04:57, 20 March 2008 (UTC)[reply]
Another technique is to use the {{sort}} template:
Number of years
1 year
2 years
5 years
10 years
20 years
25 years
sort takes two parameters: {{sort|what to sort by|what to display}}. I thought it was smarter about accepting numbers, but to make the example work, I used leading zeros so a lexicographic sort works okay. Perhaps there's another form of the sort template which deals with numbers more intuitively. —EncMstr 05:00, 20 March 2008 (UTC)[reply]

Sorting when column items encompass multiple rows?

How can this be done? Example: Opinion polling for the United States presidential election, 2008 --Kallahan (talk) 21:11, 26 March 2008 (UTC)[reply]

Several solutions come to mind using the {{sort}} template. The daunting part is defining what sorting some of those columns should do. —EncMstr 01:34, 27 March 2008 (UTC)[reply]
Can someone make this sortable? Kallahan (talk) 22:47, 30 March 2008 (UTC)[reply]
Poll Source Date administered Democrat % Republican %
Rasmussen Reports Tracking March 25-28, 2008 Hillary Clinton 40% John McCain 51%
Barack Obama 43% John McCain 48%
Gallup Tracking March 24-28, 2008 Hillary Clinton 44% John McCain 48%
Barack Obama 44% John McCain 46%
NBC News/Wall Street Journal March 24-25, 2008 Hillary Clinton 44% John McCain 46%
Barack Obama 44% John McCain 42%
Pew Research Center March 19-22, 2008 Hillary Clinton 49% John McCain 44%
Barack Obama 49% John McCain 43%
Fox News/Opinion Dynamics March 18-19, 2008 Hillary Clinton 46% John McCain 43%
Barack Obama 43% John McCain 44%
CBS News March 15-18, 2008 Hillary Clinton 46% John McCain 44%
Barack Obama 44% John McCain 46%
Does this mean it can't be done? —Preceding unsigned comment added by Kallahan (talkcontribs) 18:06, 1 April 2008 (UTC)[reply]
Well, the straightfoward change appears okay at first (below), but a click on any of the sort handles makes it fall apart immediately.
Poll Source Date administered Democrat % Republican %
Rasmussen Reports Tracking March 25-28, 2008 Hillary Clinton 40% John McCain 51%
Barack Obama 43% John McCain 48%
Gallup Tracking March 24-28, 2008 Hillary Clinton 44% John McCain 48%
Barack Obama 44% John McCain 46%
NBC News/Wall Street Journal March 24-25, 2008 Hillary Clinton 44% John McCain 46%
Barack Obama 44% John McCain 42%
Pew Research Center March 19-22, 2008 Hillary Clinton 49% John McCain 44%
Barack Obama 49% John McCain 43%
Fox News/Opinion Dynamics March 18-19, 2008 Hillary Clinton 46% John McCain 43%
Barack Obama 43% John McCain 44%
CBS News March 15-18, 2008 Hillary Clinton 46% John McCain 44%
Barack Obama 44% John McCain 46%
I'm at a loss how to remedy that, though this comes to mind:
Poll Source Date administered Democrat % Republican %
Rasmussen Reports Tracking March 25-28, 2008 Hillary Clinton
Barack Obama
40%
43%
John McCain 51%
Gallup Tracking March 24-28, 2008 Hillary Clinton
Barack Obama
44%
44%
John McCain 48%
46%
NBC News/Wall Street Journal March 24-25, 2008 Hillary Clinton
Barack Obama
44%
44%
John McCain 46%
42%
Pew Research Center March 19-22, 2008 Hillary Clinton
Barack Obama
49% John McCain 44%
43%
Fox News/Opinion Dynamics March 18-19, 2008 Hillary Clinton
Barack Obama
46%
43%
John McCain 43%
CBS News March 15-18, 2008 Hillary Clinton
Barack Obama
46%
44%
John McCain 44%
46%
Probably unsuitable, even if my mistakes were fixed.... —EncMstr 18:39, 1 April 2008 (UTC)[reply]
Actually that's brilliant. I'm going to propose it and credit you for the idea. Thanks! --Kallahan (talk) 20:25, 1 April 2008 (UTC)[reply]

Can this be got working?

Vehicle fuel consumption max. speed max. power
l/100 km mpg (imp) mpg (US) km/h mph kW hp
my car 12 24 20 160 100 300 400
your car 20 14 12 120 75 150 200
his car 24 12 10 800 500 900 1,200
her car 10 29 24 80 50 90 120

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)[reply]

Like this?
Vehicle Fuel Consumption, Speed and Power
Vehicle l/100 km mpg (imp) mpg (US) km/h mph kW hp
my car 12 24 20 160 100 300 400
your car 20 14 12 120 75 150 200
his car 24 12 10 800 500 900 1,200
her car 10 29 24 80 50 90 120
199.125.109.19 (talk) 22:28, 31 March 2008 (UTC)[reply]

Define column to be sorted by default

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

I think it does not sort by default: it displays the original page in the order the wikitext is arranged. So to have it default sorted, just rearrange the wikitext. —EncMstr 21:00, 27 March 2008 (UTC)[reply]
I had a similar need on our internal documentation wiki and having to manually sort the wiki text was not feasible in my case. It's a table of project statuses that I wanted sorted by the status column. Every time a project status changed (dev->qa for example), that meant copying/pasting the row and trying to manually keep everything in the right spot... yuck. Anyway, enough of my story. I've been fiddling with the wikibits.js and made some changes that seem to be working for us (additions in bold):

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

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

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

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)[reply]

It uses http://en.wikipedia.org/skins-1.5/common/wikibits.js containing in "newRows.sort(sortfn)" the sort function of Javascript itself. Thus the method used could depend on the browser.--Patrick (talk) 22:51, 30 March 2008 (UTC)[reply]
If the input list was initially sorted, would that make it come up faster? Bubba73 (talk), 23:01, 30 March 2008 (UTC)[reply]
JavaScript sorting is not done initially, but only after pressing the sort link, so I do not understand what you mean. Of course, putting the wikitext in the most commonly desired order is useful because it saves doing any JavaScript sorting to get that order.--Patrick (talk) 23:56, 30 March 2008 (UTC)[reply]
When I go to list of chess grandmasters in IE7, it takes a long time for it to come up initially (but not so long in Firefox). I was wondering if it was initially running the sort, which is taking a long time. But if it doesn't sort until someone click, then that can't be it. Is there anything simple that can be done to make that article come up faster? Bubba73 (talk), 15:02, 31 March 2008 (UTC)[reply]
The slow load time is a consequence of all the flag templates. Remove them and it will be much faster. — Andrwsc (talk · contribs) 20:36, 1 April 2008 (UTC)[reply]
::::: I thought that might be the case, and it was discussed on the article's talk page, but someone did a test and they found that the flags were not the problem. (See list of chess grandmasters talk page.) Bubba73 (talk), 20:43, 1 April 2008 (UTC)[reply]
It's not clear from the talk page discussion what browsers were used for that test, but it is a known problem that special code added to MediaWiki:Common.js for PNG images (which is how flag icons are thumbnailed on server caches) slows IE page loads. In any case, I think you might be better off without flags on that page anyway, for WP:Manual of style (flags) issues. — Andrwsc (talk · contribs) 21:04, 1 April 2008 (UTC)[reply]
Right. I first noticed the slowness problem with IE7. Then when I tried Firefox it was much faster. Thanks for the MoS link - I had already questioned whether there should be flags or not. Bubba73 (talk), 22:30, 1 April 2008 (UTC)[reply]

static columns

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

Anyone? Cnbrb (talk) 21:50, 9 April 2008 (UTC)[reply]

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

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)[reply]

Even sorting a notes column is useful to collect the rows which have a note entry—and the same note. If that seems haphazard, revising the note entries to make them more friendly, perhaps with standard leading keywords or tags. Granted, there are a few tables where the columns make little sense to sort, but that's hardly a reason to prevent it. Perhaps someone, somewhere has a use. —EncMstr 23:38, 9 April 2008 (UTC)[reply]
I think I have a use. In the table at List of Royal Air Force air chief marshals, I would like to create a new column on the left hand side which no matter which of the sortable columns has been clicked, it always displays 1, 2, 3, 4, ... This would enable readers to rapidy work out who was promted 20th (say) or had the 65th (say) longest time in rank etc. Any ideas on how to do this (apart from 2 nested tables which will not really work as the row hight in the right-hand sub table varies)? Thanks Greenshed (talk) 23:35, 27 November 2009 (UTC)[reply]

Requesting to view wikitable code for Help:Sorting#Examples

I'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:

  • Sortable version of Template:Climate in Middle East cities, using smn to specify numeric sort mode

Najevi (talk) 15:09, 20 April 2008 (UTC)[reply]

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)[reply]

Only some of the numbers will sort

In the article International wheat production statistics, years 2002-1999 work fine, while years 1998-1996 don't sort correctly. Is there any way to fix this, or is this a known "bug"? Esn (talk) 04:49, 23 April 2008 (UTC)[reply]

Hold on, I think I see what is causing it. The problem columns all have the entry "0NA" (signifying "negligible" or "not on the list in that year"). Is there any way to say "n/a" in a table without saying "0" (which wouldn't technically be correct)? Esn (talk) 04:53, 23 April 2008 (UTC)[reply]

Please help: Sortable table provides one round of correct sorting, another of incorrect sorting

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

Interesting. I speculate that it determines the type of comparison (string or numeric) to use by looking at the first element in the table. Once it's sorted so that "no data" is on top, it then uses a string comparison. To fix, use the {{sort|<what to sort by>|<what you see>}} template. For the no data, I expect the sort key would be 0 (zero). —EncMstr (talk) 02:53, 25 April 2008 (UTC)[reply]
Thanks for your response. I understand, somewhat, but I don't know what you mean by "first element in the table". It is definitely switching between numeric and string. I'm not really sure how to use the template; in my previews (using the Sort template) using 0, 100, and a blank space, it still didn't work properly. Any ideas? Care to tinker with it? The only method I found that works is to remove the "no data" and "see note" text entirely, but I would rather keep the text if there is a way. Whistling42 (talk) 03:42, 25 April 2008 (UTC)[reply]
This diff shows the changes I intended. I keep meaning to look up how to make {{sort}} not use a string comparison, but I just padded it with leading zeros and made it work okay. If you don't like "no data" sorting as though its value is zero, it should be clear now how to change that. —EncMstr (talk) 04:08, 25 April 2008 (UTC)[reply]

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)[reply]

The versions are sorted weirdly. Version 1.12.0 is "above" 1.9, that is, 1.12.0 was released after 1.9. You might check out mw:Version lifecycle for information on the releases. JackSchmidt (talk) 04:55, 14 May 2008 (UTC)[reply]

helpful

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

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)[reply]

Numeric sort test

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

numbers might not sort
123564589.7e12
9
4.32×104
-80
5.67
80
70
600

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

numbers should sort
123564589.7e12
9
4.32e4
-80
5.67
80
70
600

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

Sorting Negative Numbers

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

Interesting. The tables above use standard ASCII minus and the second one sorts correctly numerically. Let's test sorting with a Unicode Minus Sign here:
do numbers with Unicode Minus Sign sort Ok?
123564589.7e12
9
4.32e4
−80
5.67
80
70
600
Results: With Unicode minus the above table sorts with this cycle: 1. numeric descending, 2. numeric ascending, 3. alphabetic descending, 4. alphabetic ascending, and repeat. So you are right - unicode breaks sorting. -84user (talk) 10:40, 11 October 2008 (UTC)[reply]

Center

How do you make a box be placed in the center? — NuclearVacuum 23:52, 27 November 2008 (UTC)[reply]

Max rows for sort = 50?

Is there a maximum on the number of rows displayed for a sorting table? I have a table with 54 rows, and only the first 50 display. Those work fine, I just need the last 4 to show. Thanks in advance, Chuckiesdad (talk) 06:13, 30 November 2008 (UTC)[reply]

Withdrawn by original poster, there are lots of functional sorting tables with hundreds of entries, so this is not a Wiki problem, I'll check my browser and editor for bugs. Regards, Chuckiesdad (talk) 22:18, 30 November 2008 (UTC)[reply]

numeric sort with 1+ non-numeric elements doesn't work on firefox 3.0.4

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

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

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)[reply]

Sorting diacritic letters

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

Blank spaces treated as zero

I am struggling to find a solution to the sortable table at List of Calgary Flames draft picks that would allow the list to sort empty cells as being less than zero. I could use {{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)[reply]

Filterable

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

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

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)[reply]

Per m:Help talk:Sorting#Synch this copy with the one on en?, I have manually synched this up with meta. --fjarlq (talk) 10:55, 13 May 2009 (UTC)[reply]

Sorting with dates before 10,000 BC

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

Filter OUT, not IN

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

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

The "Sorting the wikitext of a table" section

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

Additionally, is it possible to create a table that is sorted by one of its columns by default? Shreevatsa (talk) 19:27, 25 May 2009 (UTC)[reply]

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

Clicking the Sort button jumps to top of page

Does anyone know what is going on here? In this article, only the first five columns of the table in section 5 (history) are sortable. The last buttons cause a jump to the start of the page for some strange reason. --KarlFrei (talk) 09:53, 26 June 2009 (UTC)[reply]

I don't know what the problem with this specific table is, but I noticed the same problem if I don't specify a column entry. See the example below.

sorts:

A B
a b
c

good code:

{| class="wikitable sortable" border="1"
|-
! A
! B
|-
| a
| b
|-
| c
|
|}

does not sort:

A B
a b
c

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)[reply]

Thanks! I have now realized that the problem was due to a cell spanning multiple columns. --KarlFrei (talk) 13:09, 26 June 2009 (UTC)[reply]

JavaScript sentence poorly written

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

"The JavaScript code wikibits.js has on each site a copy at {{SERVER}}/skins-1.5/common/wikibits.js, on this site http://en.wikipedia.org/skins-1.5/common/wikibits.js."

Unjedai (talk) 14:57, 26 June 2009 (UTC)[reply]

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)[reply]

I think that's what it's trying to say, yes. Don't see why it's necessary to say that, though. Shreevatsa (talk) 19:33, 23 September 2009 (UTC)[reply]
I think it's helpful because for some reason sorting isn't working on my wikis and this may help me know where to look for the problem. But I propose rewording it like this: "The JavaScript necessary to make table sorting work is at {{SERVER}}/skins-1.5/common/wikibits.js for each site. For example, on Wikipedia the URL is //en.wikipedia.org/skins-1.5/common/wikibits.js." Unjedai (talk) 15:33, 8 October 2009 (UTC)[reply]

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)[reply]

I see someone has already proposed a similar patch (class="sort-*"). I heartily approve. What will it take to get it into mainline? --IanOsgood (talk) 18:57, 5 July 2009 (UTC)[reply]

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)[reply]

Can anything be done for a table like this, which spans both multiple rows and columns? I've racked my brains but could not figure anything out. This is part of a much longer table. Thanks, Abeer.ag (talk) 18:56, 21 July 2009 (UTC)[reply]

Number Name Year Opposition Location Played Won Lost Drawn
1 CK Nayudu 1932 England England 1 0 1 0
1933/4 England India 3 0 2 1
Total 4 0 3 1
2 Maharajkumar of Vizianagram 1936 England England 3 0 2 1
Total 3 0 2 1
3 Nawab of Pataudi, Sr. 1946 England England 3 0 1 2
Total 3 0 1 2
4 Lala Amarnath 1947/8 Australia Australia 5 0 4 1
1948/9 West Indies India 5 0 1 4
1952/3 Pakistan India 5 2 1 2
Total 15 2 6 7
5 Vijay Hazare 1951/2 England India 5 1 1 3
1952 England England 4 0 3 1
1952/3 West Indies West Indies 5 0 1 4
Total 14 1 5 8
6 Vinoo Mankad 1954/5 Pakistan Pakistan 5 0 0 5
1958/9† West Indies India 1 0 1 0
Total 6 0 1 5
7 Ghulam Ahmed 1955/6† New Zealand India 1 0 0 1
1958/9 West Indies India 2 0 2 0
Total 3 0 2 1
8 Polly Umrigar 1955/6 New Zealand India 4 2 0 2
1956/7 Australia India 3 0 2 1
1958/9† West Indies India 1 0 0 1
Total 8 2 2 4
9 Hemu Adhikari 1958/9† West Indian India 1 0 0 1
Total 1 0 0 1
10 Datta Gaekwad 1959 England England 4 0 4 0
Total 4 0 4 0
11 Pankaj Roy 1959† England England 1 0 1 0
Total 1 0 1 0
Number Name Year Opposition Location Played Won Lost Drawn
12 Gulabrai Ramchand 1959/60 Australia India 5 1 2 2
Total 5 1 2 2
13 Nari Contractor 1960/1 Pakistan India 5 0 0 5
1961/2 England India 5 2 0 3
1961/2† West Indies West Indies 2 0 2 0
Total 12 2 2 8
According to our current conversation on irc://irc.freenode.net/mediawiki, it seems to be currently impossible to do that. You can either split your data in a few sortable lines, or develop a PHP extension to sort them in block. JackPotte (talk) 00:12, 15 October 2009 (UTC)[reply]
I know it's not the "right" way, but my suggestion is to do it like:
Number Name Year Opposition Location Played Won Lost Drawn
1 CK Nayudu
1932 England England 1 0 1 0
1933/4 England India 3 0 2 1
Total 4 0 3 1
2 Maharajkumar of Vizianagram
1936 England England 3 0 2 1
Total 3 0 2 1
Well, it's not perfect, but you see what I'm trying to do ~ 10nitro (talk) 16:43, 1 November 2009 (UTC)[reply]

Help with design of a table

Some of the entries in the table at List_of_National_Treasures_of_Japan_(castles)#Treasures are too long ("construction"), that's why I would like to split it in shorter entries. How shall I do that? The first column ("name") should not be changed as it contains the official name of the structure. Preferrably I would like to have a rowspan in the first column and extra rows for the various sub-structures ("Tenshu", "Northwest Small Tower",...). The problem with this is that I would lose the sorting feature as far as I know. Is there a workaround to have rowspan and sorting or a better way to arrange the table? bamse (talk) 10:43, 3 November 2009 (UTC)[reply]

Help with Alternating Colours Feature

I would like to be able to use the alternating colours feature of this without making the tables sortable. I.e. ideally I'd like to extract the alternate colours code from the rest of the sortables code and assign it to tables via a seperate class.

Example: {|class="prettytable alternate"

Unfortunately, I am a JS novice and, even after playing around with some of the code for several days, I can't seem to get it to work. Can anyone help?