Is This A Bug? Extend Cdatacolumn

Ive extended CDataColumn and am trying to set the id on the td field. When i have:




protected function renderDataCellContent($row,$data)

{

	echo("row: $row, fixture id: $data->fixtureId");

	$this->htmlOptions['id'] = $data->fixtureId;

	.......



I get:


<td id="7">row: 7, fixture id: 8</td>

I would expect to get:


<td id="8">row: 7, fixture id: 8</td>

Additionally when i try to use a form tag in the td for every row the first row doesnt get the form tag but every other row does:




protected function renderDataCellContent($row,$data)

{

	echo CHtml::form('#', 'GET', array('id'=>$data->fixture));

	echo CHtml::endForm();

}



1st row:


<tr class="odd">

<td></td>

</tr>

Every other row:




<tr class="even">

<td>

<form id="3" method="GET" action="#"></form>

</td>

</tr>



Am i missing something obvious?

Thanks for your help!

Ross

Ok first part of the post ive figured out i should be overridding


public function renderDataCell($row)

to set the id

and not


protected function renderDataCellContent($row,$data)

That bits sorted. However the first row still doesnt get the form tag when ever other one does!?




/**

	 * Renders a data cell.

	 * @param integer $row the row number (zero-based)

	 */

	public function renderDataCell($row)

	{

		$data=$this->grid->dataProvider->data[$row];

		$this->htmlOptions['id'] = $data->fixtureId;

		$options=$this->htmlOptions;

		if($this->cssClassExpression!==null)

		{

			$class=$this->evaluateExpression($this->cssClassExpression,array('row'=>$row,'data'=>$data));

			if(isset($options['class']))

				$options['class'].=' '.$class;

			else

				$options['class']=$class;

		}

		echo CHtml::openTag('td',$options);

		echo CHtml::form('#', 'GET', array('id'=>$data->fixtureId));

		$this->renderDataCellContent($row,$data);

		echo CHtml::endForm();

		echo '</td>';

	}




produces:




<tbody>

<tr class="odd">

<td>18-08-2012 15:00</td>

<td>QPR</td>

<td id="3" style="text-align:center;">row: 0, fixture id: 3</td>

<td>Swansea</td>

<td id="3" style="text-align:center;">row: 0, fixture id: 3</td>

</tr>

<tr class="even">

<td>18-08-2012 15:00</td>

<td>Arsenal</td>

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

<form id="1" method="GET" action="#">row: 1, fixture id: 1</form>

</td>

<td>Sunderland</td>

<td id="1" style="text-align:center;">row: 1, fixture id: 1</td>

</tr>



Anyone any ideas?

Thanks

Ross

Oh for flip sake. Being an eejit again. The grid view was wrapped in a form tag already which seemed to affect the first td. Not sure why but sorted now.

Thanks

Ross