Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
default_sortby
default_sortby
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['ctrl']
- Scope
- Display
If a field name for sortby is defined, then this is ignored.
Otherwise this is used as the 'ORDER BY' statement to sort the records in the table when listed in the TYPO3 backend. It is possible to have multiple field names in here, and each can have an ASC or DESC keyword. Note that the value should not be prefixed with 'ORDER BY' in itself.
Examples
Sort by title:
'ctrl' => [
'default_sortby' => 'title',
...
],
Sort by title and then by creation date:
'ctrl' => [
'default_sortby' => 'title ASC, crdate DESC',
...
],
Warning
Do not confuse this property with sortby: default_sortby should be set only if there
is no sortby. The sortby field (typically set to sorting
) contains an integer
for explicit sorting , the backend then shows "up" and "down" buttons to manage sorting of records relative
to each other. The default_sortby should only be set if that explicit sorting is not wanted or useful. For
instance, the list of frontend users is sorted by username and has no other explicit sorting field in the database.