CGridView rowspan

Hi everyone,

I have read all forum topics related to my question, but i did not find any solution.

I am working with CGridView and should use rowspan and colspan tag together.

The attached cgridview_1.png is the normal CGridView layout, but I’d like to rowspan the cell with the checkbox, and then colspan the new ones (like in cgridview_2.png).

My code now is something like this:

$this->widget('zii.widgets.grid.CGridView', array(











				'name' => 'id',


				'value' => '$data->id',

				'sortable' => true,

				'htmlOptions'=>array('style'=>'text-align: center'),



				'name' => 'col',


				'value' => 'test',






The desired HTML code is (for a row, like in cgridview_2.png):

<tr class="odd">

	<td width="5" rowspan="2"><input type="checkbox" name="rows[]" id="ccc_1" value="1"></td>

	<td style="text-align: center">1</td>



<tr class="odd"><td colspan="2">aaaa</td></tr>

but I don’t know how to do it with CGridView. Could anyone suggest something?

Thank you very much,


I’d rather use CListView in your case.

AFAIK, if you want to do it with a grid view, you have to write your own grid view class extending CGridView. And it looks much easier using a CListView than writing a customized CGridView to suit your needs.


See also this topic.

raise this thread

if someone met the same problem and googling end up here, just try this solution link groupgridview

Thanks! =D