in the end, i found this solution. overall, i must make my custom variable as SQL query. So, i can sort or search custom variable like other variable from database.
in mymodel,
declare new variable
public $LAST_DATE;
add $criteria
$criteria->select = array('*','COALESCE(location.name, \'\') AS LAST_DATE');
$criteria->order = 'LAST_DATE DESC';
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'LAST_DATE DESC',
'attributes' => array(
'LAST_DATE'=>array(
'asc'=>'COALESCE(location.name, \'\')',
'desc'=>'COALESCE(location.name, \'\') DESC',
),
'*',
),
),