and a number of other shot in the dark approaches, but obviously I am missing something very fundamental. Can anyone here point me in the right direction?
If you have the relation setted up, you can change the dataProvider like that:
$dataProvider->criteria->with('User'); //that works if you have the relation with users
$dataProvider->sort=array(
'user.name', ... //all other fields
);
Using "with" CActiveRecord will fetch even the related table, so you can sort for field in user.
as far as I know, CDbCriteria do not have ‘with’ method, so this maybe throw an error.
maybe this will work:
$criteria->with = array(
'user'=>array('select'=>'username'),
);
// then you have to declare in sort
return new CActiveDataProvider('Category', array(
'criteria'=>$criteria,
'sort'=>array(
'attributes'=>array(
'username'=>array(
'asc'=>'username',
'desc'=>'username DESC',
),
// don't forget re-define the columns of 'Category' table bc it will be overwritten