Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Do Not Display Cbuttons On Specific Row In Cgridview

$
0
0
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:

array(
  'header' => '<span title="Actions">Actions</span>',
  'class'=>'CButtonColumn',
  'template'=>'{remove}',
    'buttons'=>array(
        'remove' => array(
	   'label'=>'Remove this item from this group',     
	   'url'=>'Yii::app()->createUrl("controller/action", array("id"=>$data["id"]))',
	   'imageUrl'=>Yii::app()->request->baseUrl.'/images/icon/Remove.png',
	   '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?

Thanks!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>