You need to do two things:
- Add relation
pagepointsto withquery criteria part - The link to the column you want to sort in
orderterms of criteria
, :
$dataProvider = new CActiveDataProvider('Page', array(
'criteria'=>array(
'with' => array('pagepoints'),
'condition' => 'active = 1 AND userid IN ('.$ids.')',
'order' => 'pagepoints.points',
),
'pagination'=>array(
'pageSize'=>30,
),
));
, , , Yii SQL- ( LEFT OUTER JOIN Points), , Page model ( , it pagepoints) . , :
SELECT ... FROM Page ... LEFT OUTER JOIN `Points` `pagepoints` ...
, pagepoints.points: pagepoints - , Points - .