i think it’s better to add id property to the generated tr . for example when we use the tableDnd jquery plugin: tableDndPlugin that requires a table and its row must have the id property .
since we can get the dataRowSet 's keys ,why not render it as a row’s id ?
/**
* Renders a table body row.
* @param integer $row the row number (zero-based).
*/
public function renderTableRow($row)
{
if($this->rowCssClassExpression!==null)
{
$data=$this->dataProvider->data[$row];
echo '<tr class="'.$this->evaluateExpression($this->rowCssClassExpression,array('row'=>$row,'data'=>$data)).'">';
}
else if(is_array($this->rowCssClass) && ($n=count($this->rowCssClass))>0)
echo '<tr class="'.$this->rowCssClass[$row%$n].'">';
else
echo '<tr>';
foreach($this->columns as $column)
$column->renderDataCell($row);
echo "</tr>\n";
}
you see yii just give the tr a class property .
in the CBaseListView you can get the keys of every rows :
/**
* Renders the key values of the data in a hidden tag.
*/
public function renderKeys()
{
echo CHtml::openTag('div',array(
'class'=>'keys',
'style'=>'display:none',
'title'=>Yii::app()->getRequest()->getUrl(),
));
foreach($this->dataProvider->getKeys() as $key)
echo "<span>".CHtml::encode($key)."</span>";
echo "</div>\n";
}