Help:Sorting

Sortable tables have the ability to sort table rows based on the values inside a specific column. This is done through.

Note that sortable tables use JavaScript for sorting, and dooes not currently work on the mobile skin. If you want to sort by multiple columns, hold down Shift when you sort your second column.

Basics
Making a table sortable is easy since all that is required is appending the "sortable" class. However, certain situations such as sorting with numbers or using a table footer, require extra input, as detailed further down the page.

results in:

data-sort-type
By default, columns are sorted in ASCII order. This isn't a problem in most cases, but can be quite problematic when sorting numbers, as 10, 20, 100 will be sorted as 10, 100, 20 (since it sorts it by the first "letter" first, rather than numerically). This can be fixed using the "data-sort-type" attribute on column row headers.

can contain multiple different values, but the most common ones are: Note that if each cell in the column does not have a value of the correct type, there is a chance sorting for the whole column will go back to default.
 * text
 * number - Expects a numerical value, points, commas, spaces, "+", or "-".
 * currency - Expects a number with $, £, €, or ¥ in front (ex: $100, ¥10000)
 * date

Example:

which results in:

data-sort-value
Sometimes what you want to show in a column doesn't correspond to what order you would like it sorted by. In cases such as these  is used.

Example:

which results in:

Unsortable columns
If you have a table where you want one of the columns to not be sortable, you can do this by adding the class "unsortable" to its header.

Example:

becomes the following table:

Table footer
If you don't wish for a row at the bottom of a table to be sorted (such as a "totals" row), this can be accomplished by adding  to the row.

Example:

would produce:

Further help and feedback
ja:Help:ソーティング