How to add colgroup tag for CGridView

Hello all,

I want to add <colgroup> for the CGridView. Help me, how can I do it.


do you mean this groupColumn :lol:

see extraRow



‘template’=> ‘{view} {update} {delete}’,

‘htmlOptions’=>array(‘style’=>‘width:32px;’, ‘colspan’=>‘0’),

you are able to give your style etc to your coloumns,I think ,it is eqivalent to colgroup,isn’t it,or u want something else,please elaborate more ,what u want.

Not this.

See what I want actually.


	<!-- Want This -->


    	<col width='10%'>

    	<col width='20%'>

    	<col width='*'>


	<!-- /Want This -->


	CGridView Generated Code Here



i have the same problem.anybody know the solution? thanks

You would have to extend CGridView and override CGridView::renderItems().

You could create a method called renderColgroup for example and call it right before renderTableHeader()


	 * Renders the data items for the grid view.


	public function renderItems()


		if($this->dataProvider->getItemCount()>0 || $this->showTableOnEmpty)


			echo "<table class=\"{$this->itemsCssClass}\">\n";







			echo $body; // TFOOT must appear before TBODY according to the standard.

			echo "</table>";