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(
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'name'=>'',
'value'=>'CHtml::checkBox("rows[]",null,array("value"=>$data->id,"id"=>"ccc_".$data->id))',
'type'=>'raw',
'htmlOptions'=>array('width'=>5),
),
array(
'name' => 'id',
'header'=>'ID',
'value' => '$data->id',
'sortable' => true,
'htmlOptions'=>array('style'=>'text-align: center'),
),
array(
'name' => 'col',
'header'=>'Column',
'value' => 'test',
),
),
'selectableRows'=>'1',
'enableSorting'=>true,
));
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>
<td>test</td>
</tr>
<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,
MArkus