Help:Sorting
<languages/> <translate> In many situations, lists of page titles or user names are sorted alphabetically by MediaWiki.</translate> <translate> It is also possible to use JavaScript to sort lists of data that are included in page text.</translate>
<translate>
Sort order
</translate>
<translate> When lists are sorted alphabetically by MediaWiki, the order of characters is sorted with <tvar|1>Intl.Collator
</>.</translate>
<translate> This sorts accented characters correctly based on <tvar|1>PageContentLanguage
</>.</translate>
<translate> Android Webviews don't support this, so fallback to the old sort routine is required.</translate> <translate> The order is the same as the order of Unicode code points.</translate> <translate> Some of the more common characters are ordered as follows (in ascending order):</translate>
!"#$%&'()*+,-./0123456789:;<=>?@ABC DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg hijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐ ÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóô õö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘ ęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļ ĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠ šŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƏƒǺǻǼ ǽǾǿȘșȚțəˆˇˉ˘˙˚˛˜˝΄΅Ά·ΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘ ΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμν ξοπρςστυφχψωϊϋόύώЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВ ГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеж зийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњ ћќѝўџҐґḂḃḊḋḞḟṀṁṖṗṠṡṪṫẀẁẂẃẄẅỲỳ–—―‗‘’‚ ‛“”„†‡•…‰′″‹›‼‾⁄ⁿ₣₤₧€℅ℓ№™Ω℮⅛⅜⅝⅞←↑→↓↔ ↕↨∂∆∏∑−∕∙√∞∟∩∫≈≠≡≤≥⌂⌐⌠⌡─│┌┐└┘├┤┬┴┼═║ ╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬▀▄█▌▐░▒▓■ □▪▫▬▲►▼◄◊○●◘◙◦☺☻☼♀♂♠♣♥♦♪♫fifl�
<translate>
Categories
</translate>
<translate> Categories are sorted differently from other lists.</translate> <translate> The exact order depends on the configuration of the wiki, via <tvar|1>$wgCategoryCollation </>.</translate> <translate> The default since MediaWiki 1.17 is the Unicode code point order as above, but with all the lowercase letters turned into uppercase letters.</translate> <translate> More complex orderings are possible.</translate>
<translate>
Sorting rows of a table
</translate>
<translate> When a list of entries is included in a [[<tvar|1>Special:MyLanguage/Help:Tables</>|table]] on a page, you can use JavaScript to make the table sortable (it is not possible to force a table to be sorted by a default order on page load).</translate>
<translate> To do this, add the "<tvar|1>sortable
</>" class to the table declaration and make sure you defined headers using exclamations marks:</translate>
{| class="wikitable sortable" |- ! <translate nowrap><!--T:17--> Fruit</translate> !! <translate nowrap><!--T:18--> Price</translate> |- | <translate nowrap><!--T:19--> Apples</translate> || £0.95 |- | <translate nowrap><!--T:20--> Oranges</translate> || £0.85 |- | <translate nowrap><!--T:21--> Pears</translate> || £1.15 |- | <translate nowrap><!--T:22--> Purple mangosteen</translate> || £1.05 |}
<translate> Which produces the following output:</translate>
<translate> Fruit</translate> | <translate> Price</translate> |
---|---|
<translate> Apples</translate> | £0.95 |
<translate> Oranges</translate> | £0.85 |
<translate> Pears</translate> | £1.15 |
<translate> Purple mangosteen</translate> | £1.05 |
<translate> By clicking on the buttons in the cell headers, the entries can be sorted by the value in that column, in either ascending or descending order.
Specifying a sort key
Depending on the wiki, <tvar|1>data-sort-value
</> can be used to specify a sort key.
Example: </translate>
{| class="wikitable sortable" ! <translate nowrap><!--T:34--> Name and Surname</translate> ! <translate nowrap><!--T:35--> Height</translate> |- |data-sort-value="Smith, John George-Jackson"| John George-Jackson Smith | 1.85 |- |data-sort-value="Ray, Ian"| Ian Ray | 1.89 |- |data-sort-value="Bianchi, Zachary"| Zachary Bianchi | 1.72 |- |data-sort-value="Bianchi Maria, Adele"| Adele Bianchi Maria | 1.82 |- class="sortbottom" ! <translate nowrap><!--T:36--> Average:</translate> | 1.82 |}
<translate> gives:</translate>
<translate> Name and Surname</translate> | <translate> Height</translate> |
---|---|
John George-Jackson Smith | 1.85 |
Ian Ray | 1.89 |
Zachary Bianchi | 1.72 |
Adele Bianchi Maria | 1.82 |
<translate> Average:</translate> | 1.82 |
<translate>
Sorting in categories
</translate>
<translate> Pages in categories are sorted by their title.</translate> <translate> This can be overridden by a sort key, see [[<tvar|1>Special:MyLanguage/Help:Categories#Sort key</>|Help:Categories#Sort key]].</translate>
<translate>
See also
</translate>
- <translate> For a full documentation, see [[<tvar|1>m:Special:MyLanguage/Help:Sorting</>|Help:Sorting]] on Meta-Wiki.</translate>
- <translate> For much more detailed instructions, see the Wikipedia page.</translate>
- Manual:$wgCategoryCollation – <translate> Allows you to change the collation used for categories (requires shell access).</translate>
- <translate> [[<tvar|1>b:Unicode/Character reference</>|Unicode character references]] on the Wikibooks.</translate>
[[Category:Help{{#translation:}}]]