Совсем запуталась с сортировкой. Сейчас у меня не сортирует. а очень хотелось бы
public function actionDoctors()
{
$dataprovider = new CActiveDataProvider('Doctors', array(
'criteria' => array(
'condition' => 'doctor_region.lang = "'.Yii::app()->getRequest()->getParam('language').'" and doctor_country.lang = "'.Yii::app()->getRequest()->getParam('language').'"',
'with' => array('joinDoctorSpecialties', 'doctor_region', 'doctor_country'),
//'compare' => array('doctor_region.name', $this->doctor_region, true),
),
'pagination'=> array(
'pageSize' => 4,
),
'sort' => array(
'attributes'=> array(
'city' => array(
'asc'=>'city',
'desc'=>'city DESC',
'label'=>'Sort by city'
),
'last_name' => array(
'asc'=>'last_name',
'desc'=>'last_name DESC',
'label'=>'Sort by Last Name'
),
'doctor_region' => array(
'asc'=>'doctor_region.value',
'desc'=>'doctor_region.value DESC',
'label'=>'Sort by country',
),
'joinDoctorSpecialties.name' => array(
'asc'=>'joinDoctorSpecialties.name',
'desc'=>'joinDoctorSpecialties.name DESC',
'label'=>'Sort by Specialties',
'default'=>'desc'
),
),
),
));
$this->render('doctors',array('dataprovider' => $dataprovider));
}
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $dataprovider,
'pager' => array('cssFile'=>Yii::app()->request->baseUrl.'/themes/default/paginator.css', 'header'=>'',),
'cssFile' => Yii::app()->request->baseUrl.'/themes/default/grid.css',
'summaryText' => false,
'enableSorting'=> true,
'columns' => array(
array(
'header' => Yii::t('app', 'NAME'),
'labelExpression' => '$data->id0->first_name." ".$data->id0->last_name',
'class' => 'CLinkColumn',
'urlExpression' => 'Yii::app()->createUrl("site/viewdoctorprofile",array("id"=>$data->id))',
),
array(
'header' => Yii::t('app', 'CITY'),
'name' => 'city',
),
array(
'header' => Yii::t('app', 'CANTON'),
'name' => 'doctor_region.name',
),
array(
'header' => Yii::t('app', 'COUNTRY'),
'name' => 'doctor_country.name',
),
array(
'header' => Yii::t('app', 'SPECIALITY'),
'name' => 'joinDoctorSpecialties.name',
'value' => '$data->getSpecialInLine()',
),
array(
'header' => Yii::t('app', 'ASK_A_QUESTION'),
'class' => 'CButtonColumn',
'buttons' => array(
'ask' => array(
'label' => Yii::t('app', 'ASK'),
'url' => 'Yii::app()->createUrl("internal/index",array("id"=>$data->id))',
'options' => array('class'=>'small-button'),
),
),
'template'=>'{ask}',
),
),
));
Помогите пожалуйста, пол месяца бьюсь над этой проблемой