yii项目开发项目常用技巧和方法汇总之效果
如何根据字段值来显示不同的自定义按钮或者文字
不多说了 直接上图
视图代码 组件 CGridView
array(
'name'=>'issystem',
'type'=>'raw',
'cssClassExpression' => '(date("Ymd",$data->call_time) 'value'=>array($this, 'showUseriew')
),
'name'=>'issystem',
'type'=>'raw',
'cssClassExpression' => '(date("Ymd",$data->call_time)
),
回调方法 写在 控制器
/**
* 回调函数 显示对号和错号
*/
public function showUseriew($data, $row, $c) {
$showname = $data->issystem==1?'√':'×';
return CHtml::link($showname,Yii::app()->createUrl=\'#\'" /useriew", array("issystem"=>$data->issystem)));
}
* 回调函数 显示对号和错号
*/
public function showUseriew($data, $row, $c) {
$showname = $data->issystem==1?'√':'×';
return CHtml::link($showname,Yii::app()->createUrl=\'#\'" /useriew", array("issystem"=>$data->issystem)));
}