Hi,
I wanted to have every returned row trigger an ajax request.
I managed to get this to work by using CListView but I prefer the look of CGridView. What seems to happen is that the URL’s created by ajaxLink when contained by CGridView don’t have an id. Any idea if this is possible to do. Here’s the code that nearly works. Am I using the wrong approach. I’m fairly new to Yii, but I must say how impressed I am with it. This code works when it’s a regular ajaxLink but as soon as I try and include it as a part of CGridView it fails. The URL when clicked works as normal and gives a 404 error. Thanks in advance
$this->widget('zii.widgets.grid.CGridView', array(
"dataProvider"=>$dataProvider,
"selectableRows" => 1,
'ajaxUpdate'=>true,
'columns' => array(
'question'=>
array(
'type' => 'html',
'value' => 'CHtml::ajaxLink(
CHtml::Encode($data->question),
Yii::app()->createUrl("graph/ajaxRequest"),
array( // ajaxOptions
"type" => "POST",
"beforeSend" => "function( request )
{
// Set up any pre-sending stuff like initializing progress indicators
}",
"success" => "function( data )
{
// handle return data
alert( data );
}",
"data" => array( "val1" => "1", "val2" => "2" )
),
array( //htmlOptions
"href" => Yii::app()->createUrl("graph/ajaxRequest" ),
)
)',
)
)
));