Trouble Sorting With Related Model Using Clistview


I’ve been working with presenting data. I’m having a slight problem trying to sort the data with a related model column.

Here is my code, if anyone could point me in the right direction that would be great.


	public function actionIndex($id)



		$dataProvider=new CActiveDataProvider('Area', array(

			'criteria' => array(

			'with' =>'areaItems',

			'condition' => '',

			'params' => array(':area_id'=>$id)






				'desc'=>'title DESC'




				'desc'=>'price DESC'












My view

<?php $this->widget('zii.widgets.CListView', array(




        'title', 'price'



My relations are:

 'areaItems' => array(self::HAS_MANY, 'Item', 'area_id') // Area Model

 'Area' => array(self::BELONGS_TO, 'Area', 'area_id') // Item Model

When I try to sort the results I get the following error: CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘title’ in ‘order clause’.

I should also mention that i’ve tried referencing the table directly and through the relation like areaItems.title but I still get the following error.

Thanks in advance for any solutions