Trouble Displaying cjuidialog in gridview

I cannot get a link to display my data in a dialog within a gridview.

Static link before gridview works as expected


echo CHtml::ajaxLink('Link',Yii::app()->baseUrl.'/index.php/inventory/1',array('success'=>'function(r){$("#juiDialog").html(r).dialog("open"); return false;}'),array('id'=>'showJuiDialog'));


$this->beginWidget('zii.widgets.jui.CJuiDialog',array(

                'id'=>'juiDialog',

                'options'=>array(

                    'title'=>'Show data',

                    'autoOpen'=>false,

                    'modal'=>true,

                    'width'=>'auto',

                    'height'=>'auto',

                ),

                ));

$this->endWidget();

I then add the following into my gridview column


array(

				'name'=>'make',

				'type'=>'html',

				'value'=>'CHtml::encode($data->make) . CHtml::tag(\'br\') . CHtml::encode($data->body) . CHtml::tag(\'p\') . CHtml::ajaxLink(\'Link\',Yii::app()->baseUrl.\'/index.php/inventory/1\',array(\'success\'=>\'function(r){$("#juiDialog").html(r).dialog("open"); return false;}\'),array(\'id\'=>\'showJuiDialog\'))',

			),

I think the link in the column is not returning an ajax success because the function never gets called.

Not sure why.

The complete code may seen here http://pastebin.com/b8Dw1bcD.

Thx - Joe

This is how I have done it.It may help you

// In grid view button coloumn


array(

	'template'=>'{more}',

	'class'=>'CButtonColumn',

	'buttons'=>array(

		'more' => array(

			'visible' => 'Yii::app()->user->checkAccess(\'IvrReports.UserCallDetails\')',

			'label'=>'More Details',

			'imageUrl'=>Yii::app()->baseUrl . '/images/more-icon.gif',

			'url' => 'Yii::app()->createUrl("/IvrReports/UserCallDetails/",array(

						"caller_id" => $data["caller_id"],

						"cli" => $data["cli"],

						"called" => $data["called"],

						"redirect_num" => $data["redirect_num"],

						"channel" => $data["channel"],

						"start_time" => strtotime($data["start_time"]),

						"duration" => $data["duration"],

						"page_size" => ' . $pageSize . '

					))',

			//'click'=>'window.open("/IvrReports/UserCallDetails/")',

			'options' => array( 

				'ajax' => array( 

					'type' => 'POST',

					'url' => "js:$(this).attr('href')",

					'success'=>'js:function(data){

						  $("#jobDialog").dialog("open");

						document.getElementById("detail-section").innerHTML=data;

					 

					}'

				),

			),

		),

	),

),

// In same view page after the gridview


$this->beginWidget('zii.widgets.jui.CJuiDialog',array(

	'id'=>'jobDialog',

	'options'=>array(

	    'title'=>'User Call Details',

	    'autoOpen'=>false,

	    'modal'=>'true',

	    'width'=>'900',

	    'height'=>'500',

	),

));


<div id="detail-section"></div> 

$this->endWidget('zii.widgets.jui.CJuiDialog');

Thanks

Aruna

Thanks. My Goal is not to add an additional column with CBuutonColumn but to add a text link in the gridview data.

I have found the problem but do not understand why or how to solve it.

The following


echo CHtml::ajaxLink('Link',Yii::app()->baseUrl.'/index.php/inventory/1',array('success'=>'function(r){$("#juiDialog").html(r).dialog("open"); return false;}'),array('id'=>'showJuiDialog'));

produces <a id="showJuiDialog" href="#"> as expected.

The gridview column


array(

				'name'=>'make',

				'type'=>'html',

				'value'=>'CHtml::encode($data->make) . CHtml::tag(\'br\') . CHtml::encode($data->body) . CHtml::tag(\'p\') . CHtml::ajaxLink(\'Link\',Yii::app()->baseUrl.\'/index.php/inventory/1\',array(\'success\'=>\'function(r){$("#juiDialog").html(r).dialog("open"); return false;}\'),array(\'id\'=>\'showJuiDialog\'))',

			),

produces <a href="#"> without the defined id. I can only get class to show as an htmlOption. Any ideas?

I had to change the type from html to raw to solve the problem.