Hi guys I have been searching for the solution to this problem from more than a week.
I saw many posts , but none of them seems to work for me.
Problem :
I have a column in CGridView which calls a function in my model and make some queries and return a value
Example:
View:
Model:
Note: I can get the values for corresponding rows in CGridView. How ever I am not able to (is there a way ?) sort or filter by this column.
Help !!!
I saw many posts , but none of them seems to work for me.
Problem :
I have a column in CGridView which calls a function in my model and make some queries and return a value
Example:
View:
'columns'=>array(
'UserGroupName',
array( 'name'=>'Attendence',
'value'=>'$data->getAttendence()',
'header'=> 'Attendence',
),
Model:
public function getAttendence(){
//some math
$userIDs = $this->getUserIDs();
$totalDeliveredToThisGroup= $this->getDeliveredCount($userIDs);
$totalSeen = $this->getSeenByCount($userIDs);
if($totalDeliveredToThisGroup==0)
return '0%';
else
return round(floatval(($totalSeen/$totalDeliveredToThisGroup)*100),2).'%';
}
Note: I can get the values for corresponding rows in CGridView. How ever I am not able to (is there a way ?) sort or filter by this column.
Help !!!