Module:AutosortTable/doc

Usage
This module helps create data tables in an automatically sorted order. As of this writing it is used primarily for the generation of the huge, dynamic tables at list of Wikipedias and List of Wikipedias. For the Wikipedia editions table, the module is invoked directly to create the framework for the table, followed by content for the rows within the module's invocation. For the Edition details table, the module is invoked directly to create the framework for the table while the template generates content for the individual rows, also within the module's invocation. The template is intended to be called as an argument within the module's invocation, as it does not produce the regular wikitable (or any standard table) code itself.

The module's arguments are:

Styling tricks
While there appear to be no ways to style an individual cell when using this module, styling particular rows, columns, or the entire table can be done using CSS.

Styling the table
The style argument allows the entire table to use a default styling. For example,  would constrain the table width to 70% of the available window, and center the text (not including column and row headers) by default. When using multiple properties, the semicolon is necessary to separate them. Do not use the quotation marks ordinarily required in CSS or wikitable markup (as in ), as it causes the CSS to be disregarded. A reminder: use CSS to constrain tables sparingly, as reduced font-size or unexpected table widths may cause accessibility problems or irritate readers.

Styling a row
An individual row can be styled separately by including CSS prior to the first data cell. Consider this example table:

The row for "Henry" gets a pink color (#FFDDDD), while the row header appropriately retains the gray formatting wikitables use for headers.

Styling a column
An individual column can be styled separately by using CSS in the colstyle argument. In the Old friends example just above, the alignment has been set to  and , respectively. Consider this similar table:

The "Age" column entries are now in bolded brown and no longer left-aligned as in the previous example. The "Diet" column here has the specified yellow background.

"Wikipedia editions" example
Here is an abbreviated version of the Wikipedia editions table at list of Wikipedias. It is a manually sortable wikitable which uses the class "plainrowheaders" (no bold, not centered) for row headers (specified here as only column 1). It is auto-sorted by the sixth column ("Active users"), which is a numeric field and should be auto-sorted in descending order (highest at the top). The content of each row in the table is entered as a separate argument (starting with a pipe [|] symbol) and includes text, wikilinks, and image file links. Please view the wikicode to see the details.

"Edition details" example
Here is an abbreviated version of the Edition details table at List of Wikipedias. This table uses templates (using this module) to produce the individual rows for the table which this module will generate.

Like the above example, this is a manually sortable wikitable which uses the class "plainrowheaders" (no bold, not centered) for row headers (specified here as only column 1). However, this table is auto-sorted by the thirteenth column (based on the number of articles) which is hidden (although the same values are used again — and shown — in column 4 as "Articles"), and which is a numeric field and should be used for auto-sorting in descending order (highest at the top). The content of each row in the table is generated by the template and the call to that template is entered as a separate argument (starting with a pipe [|] symbol).

This table has some special alignment requirements, as it contains several columns containing large numbers, so the colstyle argument is used extensively. Please view the wikicode to see the details.