How to add ordering option to new admin UI

Jimako, Sat Jun 23 2018, 08:35

You need the order field, it needs be integer, not varchar (many old plugins use text field for ordering)

your_order int(10) default NULL,

for this field use type number and data int:

'type' => 'number', 'data'=> 'int',

In your admin_ui class add read parameters for options:

'options' => array(... 'readParms'=>'sort=1')

Change $listOrder variable (default is generated primary key - id)

protected $listOrder = 'your_order asc';

Add $sortField variable

protected $sortField = 'your_order';

Add $orderStep variable

protected $orderStep = 1;

Note: Reordering is done only on displayed records, maybe you need to change $perPage variable