How To Open A Cjuidialog When A Cgridview's Row Is Clicked?

I am having problems to open a dialog after clicking a CGridView’s row. Do you consider the way I am attempting this is correct?

Baiscally I have a CGridView, when I click any of its rows the method "selectionChanged" is triggered where I do a "jQuery.ajax(…"


jQuery.ajax(

	        {

	            "url":rel_url + "/rowDetails&name="+projectName+"&status="+projectStatus,

	            "cache":false,

	            "success":function(content)

	            {

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

	            }

	        });

This jQuery.ajax triggers "actionRowDetails" in my controller, this action does a "renderPartial" of a php file that contains the dialog I want to display:


<?php

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

	    'id'=>'detailsDialog',

	    'options'=>array(

	        'title'=>'Project Details',

	        'width'=>500,

	        'height'=>300,

	        'autoOpen'=>true,

	    ),

	));

	    echo 'Dialog content here';

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

?>

Inside the success method of the jQuery.ajax(… I attempt the following but it doesn’t work:


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

Any help will be highly appreciated

Diego

Just in case someone else is in the same situation, I figured out my problem:

the dialog definition must be placed in the view where it is supposed to pop up from. The property ‘autoOpen’ must be false if you don’t want it to open when page loads.

Be careful of not having a div with the same id as the CJuiDialog.


<?php

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

            'id'=>'detailsDialog',

            'options'=>array(

                'title'=>'Project Details',

                'width'=>500,

                'height'=>300,

                'autoOpen'=>false,

            ),

        ));

            echo 'Dialog content here';

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

?>

the content of the dialog is the one that should be rendered by the code of "actionXxxx" in the controller, this way, the result will be passed to the success function of the jQuery.ajax and it can be placed inside the dialog.

This way calling the following in the success function works just fine B):


$("#detailsDialog").html(content).dialog("open"); return false;

Diego