beingyii 0 Posted August 6, 2014 Report Share Posted August 6, 2014 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( 'pagination'=>array( 'pageSize'=>3, ),)); $this->render('index',array( 'dataProvider'=>$dataProvider, )); } 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- actionView() public function actionView($id) {if (Yii::app()->request->isAjaxRequest) { //outputProcessing = true because including css-files ... $this->renderPartial('view', array( 'model'=>$this->loadModel($id), ),false,true); //js-code to open the dialog if (!empty($_GET['asDialog'])) echo CHtml::script('$("#dlg-address-view").dialog("open")'); Yii::app()->end(); } else $this->render('view',array( 'model'=>$this->loadModel($id), )); } index.php <?php $this->breadcrumbs=array( 'Jobs', ); $this->menu=array( array('label'=>'Create Jobs','url'=>array('create')), array('label'=>'Manage Jobs','url'=>array('admin')), ); ?> <h1>Jobs</h1> <?php $this->widget('bootstrap.widgets.TbListView',array( 'dataProvider'=>$dataProvider, 'itemView'=>'_view', )); ?> _view.php <?php $target = 'window.location='."'".$this->createUrl('jobs/index')."'"; $dialogId = "dialog_{$data->job_id}"; $this->beginWidget('zii.widgets.jui.CJuiDialog', array( 'id'=>$dialogId, // additional javascript options for the dialog plugin 'options'=>array( 'title'=>$data->job_title, 'autoOpen'=>false, 'show'=>array( 'effect'=>'blind', 'duration'=>1000, ), 'hide'=>array( 'effect'=>'explode', 'duration'=>500, ), 'buttons' => array( array('text'=>'Route','click'=> 'js:function(){'.$target.'}'), array('text'=>'Cancel','click'=> 'js:function(){$(this).dialog("close");}'), ), 'height'=>500, 'width'=>450, 'show'=>'fade', 'hide'=>'fade', ), )); $this->renderPartial('/jobs/view',array('model'=>$data)); $this->endWidget('zii.widgets.jui.CJuiDialog'); // the link that may open the dialog echo CHtml::link(CHtml::encode($data->job_id), '#', array( 'onclick'=>'$("#'. $dialogId .'").dialog("open"); return false;', )); ?> view.php <?php $this->widget('bootstrap.widgets.TbDetailView',array( 'data'=>$model, 'attributes'=>array( array( '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_title','label'=>'Title'), array('name'=>'job_desc','label'=>'Description'), array('name'=>'job_lastdate','label'=>'Last Date'), 'job_photo', 'job_file', array( //'label'=>'Ad Photo', 'type'=>'raw', 'value'=>CHtml::tag('img', array("title"=>$model->job_photo, "src"=>Yii::app()->baseUrl."/images/".$model->job_photo, "style"=>"width:400px") ) ), //'job_createtime', ), )); ?> 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. Quote Link to post Share on other sites
Larry 428 Posted August 28, 2014 Report Share Posted August 28, 2014 Sorry for the delay. Hectic month. Are you still having problems with this? Quote Link to post Share on other sites
Recommended Posts
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.