Template:Number table sorting/doc: Difference between revisions

[checked revision][checked revision]
Content deleted Content added
Created page with "{{Documentation subpage}} {{Template shortcut|Nts}} {{Lua|Module:Number table sorting}} {{mbox | type = notice | text = Note. Adding <code>data-sort-type="number"</code> to th..."
 
 
(3 intermediate revisions by the same user not shown)
Line 4:
{{mbox
| type = notice
| text = Note. Adding <code>data-sort-type="number"</code> to the relevant column header solves many numerical sorting problems. See [[Wikipedia:Help:Sorting#Forcing a column to have a particular data type|Help:Sorting]].
}}
This template can be useful when building a [[Wikipedia:Help:Sorting|sortable table]] in which a column contains both numbers and text. This template should be applied to every number in the column and should not be used outside of sortable tables.
 
Currently, the template works for numbers between −10<sup>308</sup> and 10<sup>308</sup>. Numbers outside this range will sort above or below other numbers depending on sign. See the [[#Limitations|Limitations]] section below.
Line 12:
By default the output is displayed using thousands separators. To display numbers as entered, use {{para|format|no}}.
 
The template generates a hidden "sort key" in the [[Wikipedia:HTML|HTML]] markup which forces the [[Wikipedia:JavaScript|JavaScript]] [[Wikipedia:sorting algorithm|sorting algorithm]] to sort the column alphabetically.
 
===Purpose===
Line 68:
 
==Sort key==
The sort key is a nineteen-digit number. For numbers within range the first four digits are determined by the number's sign and [[Wikipedia:order of magnitude|order of magnitude]] and the next fifteen digits are determined by the number's sign and [[Wikipedia:significand|significand]].
 
;Numbers within range
Line 184:
 
==See also==
For documentation see wikipedia page [[wikipedia:Number table sorting]]
* {{tl|Number table sorting hidden}} - same as this template, but does not display (hides) the number
 
* {{tl|val}} - displays numbers and quantities with various formatting options
* {{tl|Convert}} - has a sortable option
* {{tl|Date table sorting}}
* {{tl|Sort}}
* {{tl|Hidden sort key}}
 
<includeonly>{{sandbox other||