Jump to content
Larry Ullman's Book Forums

Problem In Render A Model View Inside Cjuidialog

Recommended Posts

I want to render a Model view completely in the CJuiDialog box.


in actionIndex() i have pagination only for three records on the page

public function actionIndex()
		$dataProvider=new CActiveDataProvider('Jobs',array(

the view of first three records display on the CJuiDialog as apopup.

up to this working fine.


the problem is when i click on next page of pagination then it renders all view of the next records on the index page with the list view.


code is-


public function actionView($id)
	{if (Yii::app()->request->isAjaxRequest)
        //outputProcessing = true because including css-files ...
        //js-code to open the dialog    
          if (!empty($_GET['asDialog'])) 
            echo CHtml::script('$("#dlg-address-view").dialog("open")');



	array('label'=>'Create Jobs','url'=>array('create')),
	array('label'=>'Manage Jobs','url'=>array('admin')),


<?php $this->widget('bootstrap.widgets.TbListView',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");}'),

// the link that may open the dialog
echo CHtml::link(CHtml::encode($data->job_id), '#', array(
   'onclick'=>'$("#'. $dialogId .'").dialog("open"); return false;',


            'name'=>'job_id', // only admin user can see person id
            'visible'=>Yii::app()->user->name=='admin'? true : false,
		array('name'=>'job_code','label'=>'Job Code'),
		array('name'=>'job_lastdate','label'=>'Last Date'),
            //'label'=>'Ad Photo',


what is wrong in my code?

i am not getting anything.

i just think the problem is that of ajax request. because going to next page in the pagination is ajax request and because of this pagination the view of record (view.php) is partially rendered on the listview of index.php


but what will be the solution to avoid this??

help me please

Thank you.

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...