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..."
 
No edit summary
Line 2:
{{Template shortcut|Nts}}
{{Lua|Module:Number table sorting}}
{{mboxWikipedia:
{{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===