Jump to content

Help:Sortable tables

From Elite Dangerous Wiki

Make a table sortable

Add the sortable class to a normal wiki table, usually alongside wikitable:

{| class="wikitable sortable"
! System !! Population
|-
| Sol || 22,000,000,000
|-
| Lave || 1,000,000
|}

If sortable-table support is available, headers gain controls. Selecting a header sorts rows by that column; selecting it again reverses the order and a further selection may restore the original order. The initial order is the order written in the page source. Availability and exact behaviour depend on the MediaWiki version and site configuration.

Make values sort sensibly

Use consistent values in each column. Mixed text, numbers, dates and formatted values may be interpreted unexpectedly. Where supported, a header can specify a sort type, or a cell can have a separate sort value, for example | data-sort-value="1000000" | 1 million. Use these attributes only when needed and check the rendered result.

Check before publishing

Keep the same columns and cell structure in every row, and include clear header cells. Test the sorting controls in preview or after saving. Do not use sorting to replace a sensible default row order; readers may not activate the controls. For a basic table, see Help:Table.