:sortable:#
Tables can be made sortable by adding the :sortable: option.
Headers can be activated with the mouse or with the Enter and
Space keys. Blank values are placed at the bottom of the table in both ascending and
descending order.
Sorting cycle:
People |
|
|---|---|
Name |
Age |
Tom |
22 |
Alisa |
44 |
Mary |
33 |
John |
66 |
Nate |
77 |
Janice |
55 |
Automatic sort types#
By default, sphinx-tabular automatically selects a sort type for each
column.
Automatic detection uses both:
the complete header path for the logical column
the evaluated values in the column
For a multi-row header such as:
Measurements
└── Completion
the automatic sorter examines the combined header text:
Measurements Completion
Header names are treated as hints. The values in the column must still be compatible with the inferred type.
For example:
Header words |
Inferred type |
|---|---|
|
Text |
|
Version |
|
Percentage |
|
ISO date |
|
Number |
Identifier-like columns are treated as text, even when every value contains
only digits. This preserves values such as 001 and 010.