Cjuidialog: Render Complete Model View In Dialog


I want to render view.php (view of model) completely in CJuiDialog as a pop up.

(Not the Form) So many posts on this forum are about render form in the CJuiDialog. I didn’t get any post regarding how to render model view into CJuiDialog

I did some work that display the view into the dialog box,

Problem is, in index.php i have pagination to display 10 records per each page.

after going to next page views of all records render on the index page.

public function actionIndex()

	{     $dataProvider=new CActiveDataProvider('Jobs',array(









$target = 'window.location='."'".$this->createUrl('jobs/index')."'";

$dialogId = "dialog_{$data->job_id}";

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


		// additional javascript options for the dialog plugin












			'buttons' => array(

				array('text'=>'Route','click'=> 'js:function(){'.$target.'}'),

				array('text'=>'Cancel','click'=> 'js:function(){$(this).dialog("close");}'),









  //define the model

  //$model=new Jobs;


 echo CHtml::link(CHtml::encode(view),array('jobs/view','id'=> $data->job_id));








<div class="ca-item-main">

				<img class="ca-images" src="<?php echo Yii::app()->baseUrl."/images/".$data->job_photo?>"  label="<?php $data->job_photo?>"/>


						<!--<span class="ca-quote">&ldquo;</span>-->

						<span><?php  echo CHtml::Link(CHtml::encode('Job-'.$data->job_id), '#', array('jobs/view','onclick'=>'$("#'. $dialogId .'").dialog("open"); return false;',));




							<?php //echo substr($data->job_desc,0,200)." ...."; ?>




Hello beingyii,

There few things you must know before proceeding forward,

since when rendering using CJui Dialog javascript conflicts occurrs.

to avoid it first in the view form you’re poping up the dialog

add this script

 "$cs = Yii::app()->clientScript;


in the controller action of your dialog popup

set a layout (‘plain one’)

"/* setting plain layout */

        $this->layout = '//layouts/column4';"

before rendering

        /* preventing duplicating the script files this must for jquery dialog */

        Yii::app()->clientScript->corePackages = array();

        Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;

Note - if you’re using render partial if any widgets in the form those scripts wont be included to the form I’m using render to avoid it plus with renderPartial return -false, processOutput - true

$this->renderPartial('_form-popup', array('model' => $model), false, true);

my column 4 layout

<?php Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl . "/css/bootstrap_extended.css"); ?>

<div class="container-fluid">

    <div class="row">

        <div id="col-sm-9 col-lg-6">

            <?php echo $content; ?>

        </div><!-- content -->


</div> <!-- page-->

Note - Main form ajaxLinks must be uniquly identified same as the popup from ajax buttons


                echo CHtml::ajaxLink(Yii::app()->params['addANewRecord'], Yii::app()->createAbsoluteUrl('StItemMainCat/AjaxCreate'), array('update' => '#mainCatDialog'), array('id' => 'mainCatAjaxLink' . uniqid(), 'onclick' => '$("#mainCatDialog").dialog("open")'));

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

                    'id' => 'mainCatDialog',

                    'options' => Common::getDialogOptions(array('title' => 'Create New Main Category')),