CakePHP 5.x User Management Premium Plugin Version 5.0.x
How to use sorting in plugin and outside plugin
1. Set pagination variable in your controller e.g. in UsersController.phppublic $paginate = ['limit'=>25];
2. Now in controller's action you should get results from database in following way e.g. in index function$this->paginate = ['limit'=>10, 'order'=>['Users.id'=>'DESC']];
$paginated = $this->paginate($this->Users->find()->where($cond));
$users = $paginated->toArray();
$this->set(compact('paginated', 'users'));
3. Now in template file should use table headers in following way<th><?php echo $this->Paginator->sort('Users.first_name', __('Name'));?></th>
Now this table column for Name becomes sort-able
For more information see
Users Controller yourapp/plugins/Usermgmt/src/Controller/UsersController.php
Index View yourapp/plugins/Usermgmt/templates/Users/index.php
Index View yourapp/plugins/Usermgmt/templates/Users/all_users.php