nested CJuiDialog, Cgridview, $.fn.yiiGridView.update

Hi @all, I’m so newbie…

Some months of very sparse yii developing (maybe a 30 hours session of learning + coding) and I have almost finished a little application based on few tables.

No problem on models and controllers, very quick and smart coding and learning, but I’m a little bit stuck on view management.

(yii 1.1.8 and firefox and eclipse internal browsers)

I have a form with a CGridView, 2 JuiDialog nested, and I’m have some trouble on refreshing the CGridView on the original form when I close the first JuiDialog when 2nd JuiDialog it’s present.

If I comment out the second JuiDialog (used for selecting a referred data) in the first JuiDialog (an "Add new…" facility), the $.fn.yiiGridView.update works fine.

So, this is code snippet (quite long, but complicated situation… :( ) :

file _form.php


$VoceanalisiDataProvider=new CArrayDataProvider($model->voceanalisis);




					'columns'=>array( ... )));

		echo CHtml::ajaxButton(

			Yii::t('voceanalisi','Add Voceanalisi'),

		$this->createUrl('voceanalisi/addnew',array('analisi'=>$model->id)), //obiouvsly, addnew added in controller 


				'onclick'=>'$("#voceanalisiDialog").dialog("open"); return false;',




file createDialog.php





                    'title'=>Yii::t('voceanalisi','Create VoceAnalisi'),


echo $this->renderPartial('_formDialog', array('model'=>$model,'analisi'=>$analisi));


file _formDialog.php (with the incriminated JuiDialog)


		<?php $this->beginWidget('zii.widgets.jui.CJuiDialog', 

				array(	'id'=>'voce_dialog',

					// additional javascript options for the dialog plugin




		$vocedataProvider=new CActiveDataProvider('voce');


				array(	'id'=>'voce-grid',



					'columns'=>array( /* columns and some js to fill the right textField*/));



		echo CHtml::ImageButton('images/view.png', 

				array('onclick'=>'$("#voce_dialog").dialog("open"); return false;',

					 )) ?>


//there where I call yiiGridView update, thats work if I had not the voce_dialog JuiDialog on code:

echo CHtml::ajaxSubmitButton(Yii::t('voceanalisi','Create VoceAnalisi'),CHtml::normalizeUrl(array('voceanalisi/addnew','render'=>false)),array('success'=>'js: function(data) {






public function actionAddnew($analisi=NULL) {

	$model=new VoceAnalisi;




	{  //add record





	if($flag) { //render

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




It’s all right that i have ajax validation as true and all endwidgets and other stuffs allright.

Some ideas?

This piece of code if inherited from someone’s example in tutorials or this forum (I don’t remember, it’s agoust work).

I must replicate the "*Dialog.php" file structure?

For me isn’t so clear why it must be done also the first time…

Sorry for my yii ignorance - and not so beatuiful english - , but… it’s very cool… :)

Another question (maybe related with issue…):

why the addnew function it’s armed from each ajax event also on voce_dialog JuiDialog events that’s related on another model (Voce instead of VoceAnalisi) (cacthed with eclipse debugging) ?

Thank you so much,