- VolkomenJuist.nl - http://www.volkomenjuist.nl/blog -

Yii hide buttons of a CButtonColumn / TbButtonColumn

When you are using the CButtonColumn or TbButtonColumn and you want to hide a particular link you have to set the template attribute. You can also use this approach to change the order of the icons. See example below:

$this->widget('bootstrap.widgets.TbGridView', array(
	'type'=>'striped bordered condensed',
	'dataProvider'=>$dataProvider,
	'template'=>"{items}",
	'columns'=>array(
		array('name'=>'year', 'header'=>'Jaar'),
		array(
			'class'=>'bootstrap.widgets.TbButtonColumn',
			'template'=>'{update} {delete}' //removed {view}
		),
	)
	));

After writing this post I came across this post which will explain it more in detail:

http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/ [1]

Buffer [2]
[3]