关于widget的问题:
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
‘id’=>’message-grid’,
‘dataProvider’=>$model->search(),
//’filter’=>$model,
‘columns’=>array(
array(
‘selectableRows’ => 2,
//’footer’ => ‘<button type=”button” onclick=”GetCheckbox();” style=”width:76px”></button>’,
‘class’ => ‘CCheckBoxColumn’,
‘headerHtmlOptions’ => array(‘width’=>’3 x’),
‘checkBoxHtmlOptions’ => array(‘name’ => ‘select’),
),
array(
‘name’=>’visible’,
‘type’=>’raw’,
‘value’=>’$data->visible==”1″?”开启”:”关闭”‘
),
array(
‘header’=>’测试类型’,
‘name’=>’test’,
‘value’=>’$data->tag==”1″? $data->test.”标记” : $data->test’,
),
array(
‘class’=>’CButtonColumn’,
),
),
)); ?>
这个是我admin里面的代码,我在model中进行了2表的关联,问题是:标红代码中的value值我做了一个三木的判定,可以正常输出,不过我想把“标记”这两个字变成红色,或者说在里面加HTML样式,不知道怎么弄?
希望有知道的前辈指点一下了,谢了!
array(
‘name’ => ‘state’,
‘type’=>’raw’,
// ‘value’ => ‘$data->getStatusText()’,
‘value’ => ‘$data->state ? CHtml::tag(“font”,array(“color”=>”green”),$data->getStatusText()): CHtml::tag(“font”,array(“color”=>”red”),$data->getStatusText())’,
‘filter’ => $model->getStatusOptions(), //根据一个常量生成的下拉框过滤
‘headerHtmlOptions’ => array(‘width’ => ’30’),
),