Hi!
In database i have
id;number;factor
1;5;2
2;8;3
3;2;10
then in controller/admin, the page admin.php i want to multiply the number * factor. I did this:
array(
'name'=>'number',
'type' => 'raw',
'value'=>function($model, $index, $widget) {
$model->number = $model->number * $model->factor;
return $model->number;
},
'filter'=>CHtml::activeTextField($model, 'number', array('class'=>'form-control'))
),
then, the admin.php page show
id;number
1;10
2;24
3;20
but when i sort by number, the admin.php page show:
id;number
3;20
1;10
2;24
How can i sort by calculation?