Reputation: 5166
I am new to yii and using yii cgridview
to display the records . I want to use check-boxes to select the record .
what i want to produce the html like
<td>
<label class="checkbox">
<input type="checkbox" class="check">
<i class="input-new"></i>
</label>
</td>
what i getting is
<td>
<input type="checkbox" class="check">
</td>
code I am using is
array(
'name' => 'check',
'id' => 'selectedIds',
'value' => '$data->rem_id',
'class' => 'CheckBoxColumn',// <-- instead of CCheckBoxColumn
'selectableRows' => '100',
'headerTemplate'=>'<label class="checkbox">{item}<i class="input-new"></i></label>',
'checkBoxHtmlOptions'=>array(
'alt'=>'$data->rem_type','class'=>'check'),
),
Can some one help me to do this?
Upvotes: 0
Views: 165
Reputation: 875
I think you need to overwrite the renderDataCellContent
function in your CheckBoxColumn
class.
Like this:
<?php
class CheckBoxColumn extends CCheckBoxColumn {
protected function renderDataCellContent($row,$data)
{
echo '<label class="checkbox">';
echo $this->getDataCellContent($row);
echo '<i class="input-new"></i>';
echo '</label>';
}
}
Good luck!
Upvotes: 1