User:Schnark/tablesorter

From Wikimedia Commons, the free media repository
Jump to: navigation, search


This is how the code should look:

{| class="wikitable sortable"
!rowspan="2" | Jahr!!rowspan="2" | Gewinner!!rowspan="2" |  Nationalität!!colspan=5|Score
|-
! R1 !! R2 !! R3 !! R4 !! Total
|-
|1873|| {{SortKey|Kidd}}[[Tom Kidd (Golfer)|Tom Kidd]] || {{SCO}}|| 91||88 ||-- ||-- ||'''179'''(-5)
|-
|1876|| {{SortKey|Martin}}[[Bob Martin (Golfer)|Bob Martin]]|| {{SCO}}||86||90||--||--||'''176'''
|-
|1879 || {{SortKey|Anderson}}[[Jamie Anderson (Golfer)|Jamie Anderson]]|| {{SCO}}||84||85||--||--||'''169'''
|}

This currently gives a table, where only the columns below Score are sortable:

Jahr Gewinner Nationalität Score
R1 R2 R3 R4 Total
1873 Template:SortKeyTom Kidd Flag of Scotland.svg Scotland 91 88 -- -- 179(-5)
1876 Template:SortKeyBob Martin Flag of Scotland.svg Scotland 86 90 -- -- 176
1879 Template:SortKeyJamie Anderson Flag of Scotland.svg Scotland 84 85 -- -- 169
1882 Template:SortKeyBob Ferguson Flag of Scotland.svg Scotland 83 88 -- -- 171
1885 Template:SortKeyBob Martin Flag of Scotland.svg Scotland 84 87 -- -- 171
1888 Template:SortKeyJack Burns Flag of Scotland.svg Scotland 86 85 -- -- 171
1891 Template:SortKeyHugh Kirkaldy Flag of Scotland.svg Scotland 83 83 -- -- 166
1895 Template:SortKeyJohn Henry Taylor Flag of England.svg England 86 78 80 78 322
1900 Template:SortKeyJohn Henry Taylor Flag of England.svg England 79 77 78 75 309
1905 Template:SortKeyJames Braid Flag of Scotland.svg Scotland 81 78 78 81 318
1910 Template:SortKeyJames Braid Flag of Scotland.svg Scotland 76 73 74 76 299
1921 Template:SortKeyJock Hutchison Flag of the United States.svg United States 72 75 79 70 296 PO
1927 Template:SortKeyBobby Jones (a) Flag of the United States.svg United States 68 72 73 72 285
1933 Template:SortKeyDenny Shute Flag of the United States.svg United States 73 73 73 73 292 PO
1939 Template:SortKeyRichard Burton Flag of England.svg England 70 72 77 71 290
1946 Template:SortKeySam Snead Flag of the United States.svg United States 71 70 74 75 290 (+2)
1955 Template:SortKeyPeter Thomson Flag of Australia.svg Australia 71 68 70 72 281 (−7)
1957 Template:SortKeyBobby Locke Flag of South Africa.svg South Africa 69 72 68 70 279 (−9)
1960 Template:SortKeyKel Nagle Flag of Australia.svg Australia 69 67 71 71 278 (−10)
1964 Template:SortKeyTony Lema Flag of the United States.svg United States 73 68 68 70 279 (−9)
1970 Template:SortKeyJack Nicklaus Flag of the United States.svg United States 68 69 73 73 283 (−5)PO
1978 Template:SortKeyJack Nicklaus Flag of the United States.svg United States 71 72 69 69 281 (−7)
1984 Template:SortKeySeve Ballesteros Flag of Spain.svg Spain 69 68 70 69 276 (−12)
1990 Template:SortKeyNick Faldo Flag of England.svg England 67 65 67 71 270 (−18)
1995 Template:SortKeyJohn Daly Flag of the United States.svg United States 67 71 73 71 282 (−6)PO
2000 Template:SortKeyTiger Woods Flag of the United States.svg United States 67 66 67 69 269 (−19)
2005 Template:SortKeyTiger Woods Flag of the United States.svg United States 66 67 71 70 274 (−14)
2010 Template:SortKeyLouis Oosthuizen Template:RSA 65 67 69 71 272 (−16)

But in an ideal world all columns should be sortable, like this (but this is ugly code, and the headers don't look as good as they could.)

Score
Jahr Gewinner Nationalität R1 R2 R3 R4 Total
1873 Template:SortKeyTom Kidd Flag of Scotland.svg Scotland 91 88 -- -- 179(-5)
1876 Template:SortKeyBob Martin Flag of Scotland.svg Scotland 86 90 -- -- 176
1879 Template:SortKeyJamie Anderson Flag of Scotland.svg Scotland 84 85 -- -- 169
1882 Template:SortKeyBob Ferguson Flag of Scotland.svg Scotland 83 88 -- -- 171
1885 Template:SortKeyBob Martin Flag of Scotland.svg Scotland 84 87 -- -- 171
1888 Template:SortKeyJack Burns Flag of Scotland.svg Scotland 86 85 -- -- 171
1891 Template:SortKeyHugh Kirkaldy Flag of Scotland.svg Scotland 83 83 -- -- 166
1895 Template:SortKeyJohn Henry Taylor Flag of England.svg England 86 78 80 78 322
1900 Template:SortKeyJohn Henry Taylor Flag of England.svg England 79 77 78 75 309
1905 Template:SortKeyJames Braid Flag of Scotland.svg Scotland 81 78 78 81 318
1910 Template:SortKeyJames Braid Flag of Scotland.svg Scotland 76 73 74 76 299
1921 Template:SortKeyJock Hutchison Flag of the United States.svg United States 72 75 79 70 296 PO
1927 Template:SortKeyBobby Jones (a) Flag of the United States.svg United States 68 72 73 72 285
1933 Template:SortKeyDenny Shute Flag of the United States.svg United States 73 73 73 73 292 PO
1939 Template:SortKeyRichard Burton Flag of England.svg England 70 72 77 71 290
1946 Template:SortKeySam Snead Flag of the United States.svg United States 71 70 74 75 290 (+2)
1955 Template:SortKeyPeter Thomson Flag of Australia.svg Australia 71 68 70 72 281 (−7)
1957 Template:SortKeyBobby Locke Flag of South Africa.svg South Africa 69 72 68 70 279 (−9)
1960 Template:SortKeyKel Nagle Flag of Australia.svg Australia 69 67 71 71 278 (−10)
1964 Template:SortKeyTony Lema Flag of the United States.svg United States 73 68 68 70 279 (−9)
1970 Template:SortKeyJack Nicklaus Flag of the United States.svg United States 68 69 73 73 283 (−5)PO
1978 Template:SortKeyJack Nicklaus Flag of the United States.svg United States 71 72 69 69 281 (−7)
1984 Template:SortKeySeve Ballesteros Flag of Spain.svg Spain 69 68 70 69 276 (−12)
1990 Template:SortKeyNick Faldo Flag of England.svg England 67 65 67 71 270 (−18)
1995 Template:SortKeyJohn Daly Flag of the United States.svg United States 67 71 73 71 282 (−6)PO
2000 Template:SortKeyTiger Woods Flag of the United States.svg United States 67 66 67 69 269 (−19)
2005 Template:SortKeyTiger Woods Flag of the United States.svg United States 66 67 71 70 274 (−14)
2010 Template:SortKeyLouis Oosthuizen Template:RSA 65 67 69 71 272 (−16)