Gridview inside CJuiDialog

Hi all,

This is my problem:

I have a Gridview with a custom button that fires an ajax event. As a result a CJuiDialog displays in the same page and its content is the json encoded data returned by the action controller of that event.

So far so good, but here comes the problem. The content of the dialog is another gridView. It shows ok, but with no ajax interaction at all.

It seems to me (and to firebug) that the json encoded view rendered inside the dialog comes with all the html but with no jQuery.

To summarize:

1.- Gridview button fires ajax request

2.- A controller process that request and returns another gridview json encoded. Something like this:

  if (Yii::app()->request->isAjaxRequest)


            echo CJSON::encode(array(


                'div'=>$this->renderPartial('manage', array('model'=>$model, 'component_id'=>$component_id, 'profile_id'=>$profile_id), true)));



3.- This ‘div’ is set as the content of a CJuiDialog in the same page. It shows OK.

4.- But I cannot search, filter, paginate or launch ajax events from de grid inside de dialog. I think that no jQuery is loaded in the page to deal with this second grid events.

I´ve tried setting the fourth parameter of renderPartial to true to force script generation, but it returns "null" when I do that.

Anyone has tried something like this? Have you faced the same issues?

Thanks in advance.

This thread can be useful for your case.

(Since GridView was introduced in Yii 1.1, this thread should be moved to the "General Discussion for Yii 1.1.x" section.)


Thanks for the feedback but I´m not quite sure if that could help me. In my case the dialog that shows the second gridview is modal, I don´t need the first gridview to do anything while the dialog is open, I just need the modal dialog and its gridview to be operative, but no jquery code seems to be generated to handle it.

By the way, I´m using this extension to load client scripts, maybe that´s the problem?


I´m stock with this. Using the standard ClientScript has the same effect ond the second gridview (the modal one).