Controlling output order: Difference between revisions

m
Minor cleanup
imported>FrozenPlum
m (Move the bit NOT related to DPL3 itself, to the bottom (didn't make sense to have it first, when I'm looking for information about DPL3 use, and this was advice that would work for MW tables in general and was non-specific to DPL3))
imported>FrozenPlum
m (Minor cleanup)
 
(4 intermediate revisions by the same user not shown)
Line 1:
{{purgenote}}
{{DPL manual|section=Parameters|subsection=Controlling output order}}
{{tocright}}
Line 27 ⟶ 26:
|-
|'''''categoryadd'''''
|Orders list based on the most recent addition to the first category specified (requires tothe include'category' parameter, only one category andcan onebe onlyincluded usingto 'category' parameterwork).
{{note|See '''''sortkey''''' for sorting by page order in a category.}}
|-
Line 41 ⟶ 40:
|-
|'''''lastedit'''''
|Orders list based on the most recent edit to the pages.
|-
|'''''pagetouched'''''
|Orders list based on 'page_touched' timestamp. Read the comment on the page_touched field in [[mw:Page_table|Page_table]] to see the difference from most recent edit by an author.
|-
|'''''pagesel'''''
Line 116 ⟶ 115:
 
 
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:{{PAGENAME}}Examples/Parameter:_ordermethod_ ordermethod (example 1)|Example}}
{{ViewTest|Examples|Parameter: ordermethod (example 1)}}
{{example|ordermethod|eg=1}}
 
'''Result:'''<br><!-- transclude example from subpage-->{{#lsth:{{PAGENAME}}Examples/Parameter:_ordermethod_ ordermethod (example 1)|Result}}
 
 
Line 133 ⟶ 132:
 
''orderdirection'' can be one of:
* ''descending'' — dependingDepending on the critriacriteria set, largest to smallest, most to least, 9 to 0 and/or Z to A
* ''ascending'' — dependingDepending on the critriacriteria set, smallest to largest, least to most, 0 to 9 and/or A to Z — ('''default''', needsneed not be set)
 
 
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:{{PAGENAME}}Examples/Parameter:_order_ order (example 1)|Example}}
{{ViewTest|Examples|Parameter: order (example 1)}}
{{example|order|eg=1}}
 
 
'''Result:'''<br><!-- transclude example from subpage-->{{#lsth:{{PAGENAME}}Examples/Parameter:_order_ order (example 1)|Result}}
 
 
Line 158 ⟶ 157:
* For case insensitivity during the ''selection'' of articles, see {{DPL|ignorecase}}.
* You may want to try <code>latin1_swedish_ci</code> or other collation mapping table names as well. If you use a name for the first time, you should make sure that it is spelled correctly. Otherwise, you will see a SQL error message.
* A very special (proprietary) function can be used to sort card suit symbols according to the rank of suits that is used in the card game of bridge (this cannot be done by standard collating sequences). To trigger this function, set <code>ordercollation=bridge</code>.
 
==Other ways to sort==
 
===tablesortcol===
{{#lsth:Examples|tablesortcol}}<!-- transclude from other page -->
 
===Using JavaScript===
 
In some cases, DPL3 sorting features are sufficient; think of the following example:
Line 169 ⟶ 173:
 
But there is another way:
* Create a ''sortable wiki table'' (using the {{DPL|table}} option of DPL3 with <code>class="wikitable sortable"</code>) and you can click on the column headings to sort your output accordingly. However, the initial order shown in that table will still be the order in which DPL3 parsed the wiki pages (usually an alphabeticalphabetical order of the page names).
 
Using a handful of JavaScript lines, you can sort a wikitable ''on pageLoad'' by any column. You must insert that JavaScript code AT THE END of your page:
Anonymous user