Has anyone tried to get the row data from a CGridView? Please take a look at my ‘selectionChanged’ code. When I execute it I’m getting the following error:
“Uncaught TypeError: Cannot read property of ‘tableClass’ of undefined” This error is showing up in the jquery.yiigridview.js code for the “getRow” function.
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'task-grid',
'dataProvider'=>$taskProvider,
'template'=>"{items}",
'showTableOnEmpty'=>true,
'selectableRows'=>1,
'selectionChanged'=>
'function(id){
var row_data = $("task-grid").yiiGridView.getRow(0);
alert(row_data);
var task_id = parseInt($.fn.yiiGridView.getSelection(id));
$("#task_dialog").dialog("open");
}',
'columns'=>array(
array(
'name'=>'priority',
'header'=>'Pri',
'type'=>'html',
'value'=>array($this,'formatPriority'),
),
array(
'name'=>'title',
'htmlOptions'=>array('width'=>'175px'),
),
array(
'name'=>'dueDate', //0000-00-00 00:00:00
'value'=>'($data->dueDate == "0000-00-00")
? "None"
: date("F j, Y", strtotime($data->dueDate))',
'htmlOptions'=>array('width'=>'100px'),
),
array(
'name'=>'category',
'value'=>CHtml::encodeArray(array($this,'formatCategory')),
'htmlOptions'=>array('width'=>'85px'),
),
'description',
),
));
Thanks for your help.