Order the rows in different ways when a table is shown.
This feature module is part of the TablePress Premium plans.
For some tables, it can be useful to show the rows in random, reversed, sorted, or manually chosen order each time.
The same is possible for columns using the Column Order feature module.
Feature description
Here are examples:
Normal order
This is an example table:
Name | Year | Country | Sport |
---|---|---|---|
Eric | 1986 | Sweden | Soccer |
Julia | 1991 | Germany | Basketball |
Adam | 2002 | Indonesia | Golf |
Kim | 1986 | Chile | Badminton |
Jackson | 1998 | Australia | Baseball |
Reversed order
This is the same table but in automatically reversed order:
Name | Year | Country | Sport |
---|---|---|---|
Jackson | 1998 | Australia | Baseball |
Kim | 1986 | Chile | Badminton |
Adam | 2002 | Indonesia | Golf |
Julia | 1991 | Germany | Basketball |
Eric | 1986 | Sweden | Soccer |
In addition, it is possible to chose “random” as the row order, which is a good way to prevent that some rows get more “attention”, e.g. when showing reviews or products.
Using the “manual” order, it is possible to show only some desired rows of a table.
Usage instructions
To use this feature with your tables, choose the desired options in the “Row Order” section of the “Settings” sidebar of the table’s “TablePress table” block when editing the post or page with the table.
Configuration parameters
To configure this module’s features, you can also use these configuration parameters in the “TablePress Table” block or in the Shortcode that you are using to embed the table:
Module | Slug | Configuration parameter | Name | Description | Type | Default value | |
---|---|---|---|---|---|---|---|
Row Order | row-order | row_order | enum (default , reverse , sort , or manual ) | default |
|||
Row Order | row-order | row_order_sort_column | string | "" (empty string) |
|||
Row Order | row-order | row_order_sort_direction | enum (asc or desc ) | asc |
|||
Row Order | row-order | row_order_manual_order | string | "" (empty string) |
Reversed order
To show a table in reversed order, use the Shortcode
[table id=123 row_order=reverse /]
Code language: JSON / JSON with Comments (json)
and change the 123
to the desired table ID.
Random order
To show the rows of a table in random order, use the Shortcode
[table id=123 row_order=random /]
Code language: JSON / JSON with Comments (json)
Sorted order
To show the table pre-sorted by a desired column, use the Shortcode
[table id=123 row_order=sort row_order_sort_column=A row_order_sort_direction=DESC /]
Code language: JSON / JSON with Comments (json)
Using the parameters row_order_sort_column
and row_order_sort_direction
, you can define the column that shall be sorted and the sorting direction (ASC
for ascending or DESC
for descending order).
Manual row order
To show specific rows of a table in a desired order, you can use the Shortcode
[table id=123 row_order=manual row_order_manual_order="5,2,8-12" /]
Code language: JSON / JSON with Comments (json)
The parameter row_order_manual_order
can be used to define the rows that shall be shown and their order, as a comma-separated list and as ranges of rows. In addition, the values all
for all table rows in their original order, and reverse
for all table rows in reversed order are possible.
On this page