Fixed the links and sorting for the contacts grid
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@741 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -25,17 +25,19 @@ class ContactsController extends AppController {
|
|||||||
|
|
||||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||||
if ($index === 'Contact.last_name') {
|
|
||||||
$order[] = 'Contact.first_name ' . $direction;
|
// After sorting by whatever the user wants, add these
|
||||||
}
|
// defaults into the sort mechanism. If we're already
|
||||||
if ($index === 'Contact.first_name') {
|
// sorting by one of them, it will only be redundant,
|
||||||
$order[] = 'Contact.last_name ' . $direction;
|
// and should cause no harm (possible a longer query?)
|
||||||
}
|
$order[] = 'Contact.last_name ' . $direction;
|
||||||
|
$order[] = 'Contact.first_name ' . $direction;
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||||
$links['Contact'] = array('id');
|
$links['Contact'] = array('last_name', 'first_name');
|
||||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user