Template:Hiddenkey
From Wikipedia, the free encyclopedia
This template is designed to simplify the process of writing sorted tables.
Tables are sorted based on the initial contents of each cell. This is ideal in many circumstances, but in some cases you might want a column to be sorted on a different key. For example, in this table:
Date | Day | Present |
---|---|---|
5 January 2007 | 12 | drummers drumming | twelve
4 January 2007 | 11 | pipers piping | eleven
3 January 2007 | 10 | lords a-leaping | ten
2 January 2007 | 9 | ladies dancing | nine
1 January 2007 | 8 | maids a-milking | eight
31 December 2006 | 7 | swans a-swimming | seven
30 December 2006 | 6 | geese a-laying | six
29 December 2006 | 5 | gold rings | five
28 December 2006 | 4 | four calling birds |
27 December 2006 | 3 | french hens | three
26 December 2006 | 2 | turtle doves | two
25 December 2006 | 1 | partridge in a pear tree | a
we want the last column to be sorted on the name of the present, not how many were given.
We can achieve this by putting some "invisible" text at the beginning of the cell. This template makes that text invisible for you.
{| class="wikitable sortable" !Date!!Day!!Present |- |{{hiddenkey|20070105}}[[5 January]] [[2007]] |12||{{hiddenkey|drummers}}twelve [[drummers]] drumming |- |{{hiddenkey|20070104}}[[4 January]] [[2007]] |11||{{hiddenkey|pipers}}eleven [[pipers]] piping |- ... |- |{{hiddenkey|20061225}}[[25 December]] [[2006]] |1||{{hiddenkey|partridge]]}}a [[partridge]] in a pear tree |- |}
Notice that the {{hiddenkey}} template is also used to put the date in a format which is easily sorted.
See User:TimR/Tables for further information.