My action method in the controller is as follows, nothing special.
/**
* Shows a particular model.
*/
public function actionShow()
{
$criteria=new CDbCriteria;
$criteria->order = 'task';
$pages=new CPagination(Task::model()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
$sort=new CSort('Task');
$sort->applyOrder($criteria);
$models=Task::model()->findAll($criteria);
$this->render('show',array(
'models'=>$models,
'pages'=>$pages,
'sort'=>$sort,
));
}
I would like to sort the data($models) by task numbers which happen to be such as ‘1.1’, ‘1.2’, … ,‘1.9’ and ‘1.10’.
So my question is how I would sort the task number using CSort (or some other way). I was not able to find the custom sort algorithm in CSort class.
Without a special care, the sort result might be like ‘1.1’, ‘1.10’, ‘1.2’ … Of course I prefer to have it sorted as ‘1.1’, ‘1.2’, … , ‘1.9’ and ‘1.10’.
Thank you in advance for your hint.