I'm using GridView (generated by Gii) with ActiveRecord. Let's say I have a table with a column named "number". I added a function to the model, it's something like this:
public function getCos()
{
return cos($this->number);
}
I can't see how should I sort columns like this one, with numeric calculated values which are not just the concatenation of two columns, like the case described here:
https://www.yiiframework.com/wiki/621/filter-sort-by-calculatedrelated-fields-in-gridview-yii-2-0
Values could be calculated in the view instead of model:
'value'=>function($model, $key, $index, $widget){return cos($model->number);
But the problem is the same, I can't see how to sort this kind of column.
Thank you.