In admin.php, I have a gridview where I created a dropdownlist. I have the following values, i.e 0-> No Activity 1->Pending 2->Approved 3-> Rejected. How can I specify here in the below code and display the corresponding values for the numbers in the gridview cells.
array(
'name' => 'Test',
[b]'value' =>?[/b]
'visible' => ($approval=="1")?true:false,
'filter' => array('0' => 'No Activity', '1' => 'Pending','2' => 'Approved', '3' => 'Rejected',''=>'All'),
// 'headerHtmlOptions' => array('style'=>'text-align:center; vertical-align: middle;font-size: 15px !important;'),
'htmlOptions' => array('style' => 'width: 500px;'),
),
Ankit_Modi
(Ankit Modi)
September 2, 2013, 11:16am
2
array(
'name'=>'status',
'filter'=> array('1'=>'Active','0'=>'Inactive','3'=>'Pending'),
'type' => 'html',
'value'=> 'CHtml::tag("div", array("style"=>"text-align: center" ) , CHtml::tag("img", array( "title"=>UtilityHtml::getImagetitle(GxHtml::valueEx($data, \'status\')),"src" => UtilityHtml::getLiquorStatusImage(GxHtml::valueEx($data, \'status\')))))',
'htmlOptions' => array('width' => '8%'),
),
in you common file call a function (add a image tilte and status image add ) you can just change this file name like b [/b]
public static function getImagetitle($status) {
if ($status == 1) {
return 'Active';
} else if ($status == 0) {
return 'Inactive';
} else if ($status == 3) {
return 'Pending';
}
}
public static function getLiquorStatusImage($status) {
if ($status == 1 || strtolower($status) == 'yes') {
// return active image
return Yii::app()->request->baseUrl . '/images/checked.png';
} else if ($status == 0) {
// return inactive image
return Yii::app()->request->baseUrl . '/images/unchecked.png';
} else if ($status == 3) {
// return pending image
return Yii::app()->request->baseUrl . '/images/error.png';
}
}