Including widget javascript in renderPartial views

Hi guys,

My main page is a list of posts, but I decided to make the “create” page a modal lightbox-style popup. Not really a problem—I just make a DIV appear when they hit “create” and I load in into that DIV. I have set my create.php page to “renderPartial” so that the DIV doesn’t include all the header, logo etc.

Trouble is that when I load a widget on that lightbox create page, it doesn’t seem to insert its code correctly. Specifically, I am using the muploadify widget, which, when called on a page using $this->render, seems to inject its Javascript at the bottom of the page. But when I use $this->renderPartial, it doesn’t.

I presume that Yii is doing some trickery about how and where it injects Javascript that is simply missing if I load a page in dynamically into a DIV?

Any thoughts on a solution to this?



try to make parameter $processOutput in renderPartial(); function to be (true)

the renderPartial function is like:

 renderPartial($view, $data, $return, $processOutput);

and this is an example:

$this->renderPartial('test', array('test2'=>$test2), true, true);

Hmm… thanks, but that did not seem to do the trick. I still don’t get any injected Javascript. I guess the question is, with a widget like MUploadify, where does it inject its Javascript? Because if I call the create page directly using renderPartial there is no Javascript at the bottom, but if I call it using render then I see a whole lot of added code at the bottom.

Any other ideas chaps?



My mistake! I had only put one "true" parameter instead of two.

Works great now, thank you so much for your help.



good to know that your problem solved this way :)

Muaid, Thanks for the useful information. Actually you saved my time.