Skip to content

Instantly share code, notes, and snippets.

@mneuhaus
Last active August 16, 2016 11:35
Show Gist options
  • Save mneuhaus/58437042f745d64c77e68df61ee278bd to your computer and use it in GitHub Desktop.
Save mneuhaus/58437042f745d64c77e68df61ee278bd to your computer and use it in GitHub Desktop.
  1. Add sorting field to table in ext_tables.sql
sorting int(11) DEFAULT '0' NOT NULL,
  1. add sorting field in table TCA extension/Configuration/TCA/table_name.php to columns
'sorting' => array(
	'config' => array(
		'type' => 'passthrough',
	),
),
  1. add sorting field to interface and types in extension/Configuration/TCA/table_name.php
'interface' => array(
	'showRecordFieldList' => 'sys_language_uid, ..., sorting',
),
'types' => array(
	'1' => array('showitem' => 'sys_language_uid;;;;1-1-1, ..., sorting'),
),
  1. Set sortby in ctrl section to sorting in extension/Configuration/TCA/table_name.php
'ctrl' => array(
	'title'	=> 'table title bla bla',
	...
	'sortby' => 'sorting',
       ...
),
  1. Add default sorting in Model Repository:
class MyTableRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{

    /**
     * @var array
     */
    protected $defaultOrderings = array(
        'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
    );

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment