Adding a check box or other button to a CGridView

I know it is possible to add a check box to each row of the CGridView, but is I possible to add some logic based on the data provider to each line.

(i.e. if the contents of one of the columns on a given row is 0 add a check box, and if the value is 1 add a hyperlink.)

Here is my code:

$dataProvider=new CActiveDataProvider('data_products', array('criteria'=>array('condition'=>'dataRequestType=0') ) );

$this->widget('zii.widgets.grid.CGridView', array(
















Would I just add an if statement ‘columns’ array or is there some other logic I’m missing.


I suggest you try something like this


'value' =>'$data->some_attribute ? CHtml::link(...) : CHtml::checkBox(...)',


(not tested)


Thanks a lot that work perfectly.