Hello
In model:
public function search()
{
$criteria=new CDbCriteria;
$criteria->select ='t.*,
TIMESTAMPDIFF(MINUTE , now() , (t.startdate + interval t.days day)) as timetoend';
in view:
<?php
$dataProvider=$model->search();
$dataProvider->sort->attributes=array(
'timetoend',
);
$this->widget('application.components.GridView', array(
now i cant sort by time toend becaouse it sorting by t.timetoend
SQL: SELECT t.*, TIMESTAMPDIFF(MINUTE , now() , (t.startdate + interval t.days day)) as timetoend FROM `User` `t` ORDER BY `t`.`timetoend` LIMIT 20
i need a method to tell model to use or not to use prefix in sorting condition.