I am attempting to assign a unique id to each table row in Yii's CGridView
.
Preferably something like $data->id
from the database table.
I have been unsuccessful at adding an id
attribute to each rendered <tr>
.
Any suggestions would be most appreciated.
CGridView have an option called 'rowHtmlOptionsExpression' , you can declare like the followings to assign row an id
'rowHtmlOptionsExpression' => 'array("id"=>$data->id)',
It's better than hacking into 'rowCssClassExpression'
Good luck !