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/

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>