Table of Contents
How to sort a table in wpDataTables
Say your task list should open with the most urgent tasks at the top, sorted by due date. wpDataTables tables are sortable by default: visitors click a column header to sort by it. You decide which column the table is sorted by when the page opens, in which direction, and which columns visitors can sort. You can set this with Tabella AI or in the table and column settings.
How do I set the default sorting with Tabella AI?
Open the table, click Ask Tabella AI and name the column and the direction.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Ask Tabella AI. Click Ask Tabella AI and type, for example: Sort the table by Due date, oldest first. To stop sorting on one column, ask in a new message, for example: Turn off sorting for the Owner column.
- Check and save. Read the reply of Tabella AI and check the preview. For the Owner example, it lists Column “Owner”: sorting: disabled. Click Save Changes to keep the change, or Undo table changes to go back.
How do I set the default sorting in the column settings?
Turn on Use as default sorting column in the Sorting tab of the column, choose the direction and save the table. Without it, the table is sorted by the first column, in ascending order.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Open the column settings. In the table preview, click the settings icon in the header of the column to sort by, for example Due date.
- Make it the default. In the Sorting tab, turn on Use as default sorting column (Sort table by this column on load). Default sorting direction appears below.
- Choose the direction. In Default sorting direction, select Ascending (A to Z, smallest or oldest first) or Descending.
- Save the table. Click Save Changes.

How do I turn sorting on or off?
Use Allow sorting for the table in the Sorting and filtering tab for the whole table, and Allow sorting for this column in the Sorting tab of a column for a single column. Both are on by default.
To open the table sorted by one column while visitors can’t change the order, keep Allow sorting for the table on, turn on Use as default sorting column in one column, and turn off Allow sorting for this column in every column. With sorting off for the whole table, the default sorting column doesn’t apply.
How do visitors sort the table on the front end?
Visitors click a column header to sort by that column in ascending order, and click it again for descending order. The arrow next to the header shows the direction, and the sorted column is highlighted.
To sort by a second column, visitors sort by the first one, then hold Shift and click another header. Rows with the same value in the first column are then ordered by the second, for example tasks with the same status by due date.
The sort order follows the column type: text columns sort alphabetically, integer and float columns by value, and date and time columns by date and time. Read Column types overview to pick the right type, because numbers in a text column sort as text (1, 10, 2).
What should I remember about sorting?
Tables are sortable by default. Ask Tabella AI, or turn on Use as default sorting column in a column’s Sorting tab, to choose the order the table opens with, and turn sorting off for single columns or the whole table where you don’t need it. Visitors sort by clicking headers and add a second column with Shift and click, and the column type decides the order.
Where can I read more?
These pages cover other ways to organize table data: