Forum:Sorting tables

How on earth do you sort a field of a table to something other than its actual value?-- 17:19, May 20, 2010 (UTC)


 * Just what I was thinking.--Secundomia 17:56, May 20, 2010 (UTC)


 * Depending on what your doing(show us what wiki it's on), you could add another column to the table with a value or type of thing you want to sort by. Alternatively, if the "actual value" is not important, you could prepend an invisible(same foreground and background color) value to the field possibly with a very small font so that it's not noticeable. --Sxerks 18:24, May 20, 2010 (UTC)


 * Create a template based on the template on Wikipedia (Wikipedia:Template:Sort), which does exactly what you're asking for. —Lowellian (reply) 01:19, May 22, 2010 (UTC)


 * The sort is performed on whatever element appears first in the cells of any given column. It is either alphabetical sort or numeric sort depending on the data. (refer to mw:Help:Sorting and/or for a discussion of the limitations of the sort feature) Unfortunately some data is ambiguous so the resultant sort order is counter-intuitive. The rather well documented remedy (mw:Help:Sorting) is to use an invisible sort value as the very first element of each cell in a column using a format such as

095
 * The "display:none" style makes this dummy sort value invisible and the value itself is, in this case, 3 digit numeric with a leading zero if required.


 * An example table that uses this remedy can be viewed at


 * -- najevi 03:30, May 25, 2010 (UTC)