Do Not Display Cbuttons On Specific Row In Cgridview

Howdy folks,

This ones got me stumped, hope you can help!

I have a grid view populated by a CArrayDataProvider.

The view contains a primary row, and its sub rows.

I want to display a button only one the sub rows.

The button view currently looks like this:


  'header' => '<span title="Actions">Actions</span>',




        'remove' => array(

	   'label'=>'Remove this item from this group',     

	   'url'=>'Yii::app()->createUrl("controller/action", array("id"=>$data["id"]))',


	   'options'=>array('title'=>'Remove this item from this group'), 




What I’d like to include is something along the lines of:

if($data['id'] == $Yii::app()->session['primaryId']) { Don't display the button }

So basically display the button on all the rows in CGridView except the 1 row that matches the primary ID.

Is there a way to do this?



'visible'=>'...',   // a PHP expression for determining whether the button is visible

Thanks Tsunami!

That did the trick :)

'visible'=>'$data["id"] != Yii::app()->session["primaryId"]',


you can write a ternary operator (if condition) on admin grid view…


'value' => '($data["active"] == 1 ? " ":"abc")',