Row Order

Order the rows in different ways when a table is shown.

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:

NameYearCountrySport
Eric1986SwedenSoccer
Julia1991GermanyBasketball
Adam2002IndonesiaGolf
Kim1986ChileBadminton
Jackson1998AustraliaBaseball

Reversed order

This is the same table but in automatically reversed order:

NameYearCountrySport
Jackson1998AustraliaBaseball
Kim1986ChileBadminton
Adam2002IndonesiaGolf
Julia1991GermanyBasketball
Eric1986SwedenSoccer

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.

The available settings for the Column Order module in the "Settings" sidebar of the "TablePress table" block.
The available settings for the Column Order module in the “Settings” sidebar of the “TablePress table” block.

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:

ModuleSlugConfiguration parameterNameDescriptionTypeDefault value
Row Orderrow-orderrow_orderenum (default, reverse, sort, or manual)default
Row Orderrow-orderrow_order_sort_columnstring"" (empty string)
Row Orderrow-orderrow_order_sort_directionenum (asc or desc)asc
Row Orderrow-orderrow_order_manual_orderstring"" (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.