Cakephp 2.x User Management Premium Plugin Version 2.1


Sorting is very easy in Cake Php please make sure sorting works with cake php pagination.

How to use sorting in Cake Php
1. set pagination variable in your controller for e.g. in UsersController.php

public $paginate = array(
            'limit' => 25

2. Now in any function you should get results from Database in following way for e.g. in index function

$this->paginate = array('limit' => 10, 'order'=>' desc');
$users = $this->paginate('User');

$this->set('users', $users);

3. Now in View file you should use table headers in following way-

<th><?php echo $this->Paginator->sort('User.first_name'__('Name')); ?></th>
Now this table column for Name becomes sortable.

For more information see
Users Controller yourapp/app/Plugin/Usermgmt/Controller/UsersController.php
Index View yourapp/app/Plugin/Usermgmt/View/Elements/all_users.ctp