I'm new to Yii. I have a gridview with search boxes. One of these search boxes has to be replaced by dropdown list. Based on the dropdownlist value the value in the gridview cells should be replaced.
Suppose, I use (0-> No Activity, 1->Pending, 2->Approved, 3-> Rejected)
. I need to replace the values 0 with No Activity, 1 with Pending, 2 with Approved, 3 with Rejected respectively both in Gridview cell and dropdownlist.
What should I mention in the value of the array
array(
'name' => 'Test',
'value' =>
'filter' => array('0' => 'No Activity', '1' => 'Pending','2' => 'Approved', '3' => 'Rejected',''=>'All'),
'htmlOptions' => array('style' => 'width: 500px;'),
),
I'm using PHP 5.2
and Yii version 1.13
I edited the below code , and this works fine for me
EDIT :
function getTestType($test)
{
$testTypesList = array('0'=> 'No Activity', '1'=>'Pending', '2'=>'Approved', '3'=> 'Rejected',''=>'All');
if(is_null($test)){
return 'All';
}else{
return $test=$testTypesList[$test];
}
}
and in view
array(
'name' => 'Test',
'value' =>'getTestType($data->textfield)'
'filter' => array('0' => 'No Activity', '1' => 'Pending','2' => 'Approved', '3' => 'Rejected',''=>'All'),
'htmlOptions' => array('style' => 'width: 500px;'),
),