Yii List view sorting for relation values -


in yii project using listview display data in table view.

sorting option working existed database colums.

now want display relation values in list view. values getting relations. like:

 'noofimages'=>array(self::belongs_to,'images','user_id') 

now how add sorting 'noofimages' column.

 <td><?php echo chtml::encode($model->noofimages); ?></td>     

in above code 'noofimages' not db column . it's calculated value through relations of model.

thanks in advance.

to access property add public $noofimages model. sure can calculations need(for example in afterfind method)


Comments