Ajax views and widgets

Hi !

I have searched for my problem on the forum without any success.

I have problem in AJAX views. For example, I would like to display a CAutoComplete widget but the CSS and JS of the widget are not loaded, since the registerScript and registerCssFile of the CAutoComplete component are done in the AJAX view.

What is the best way to display a CAutoComplete (or any other widgets using CCS and JS) in an AJAX view ?

Thank you.

Eye

There was an issue with this a very long while ago, the fix was to change the render partial method to add a fourth parameter (processOutput) … Are you setting that parameter to true in your code ? See http://www.yiiframework.com/doc/api/1.0.10/CController#renderPartial-detail

See reported issue http://www.yiiframework.com/forum/index.php?/topic/88-ajax-controls-and-render-partial-not-being-bound/page__hl__ajax__fromsearch__1

Your problem may also be related to this issue http://code.google.com/p/yii/issues/detail?id=38

This issue is caused by Yii sending to much javascript a second time to the page. For example your page requires jQuery and it is included then via ajax you replace a portion of the page with controls that require ajax. Since Yii is mostly stateless it does not know that jQuery is already on the page so it sends the code to require jQuery on the page with the content. Now you have a second instance of jQuery - this tends to make a mess of things. If you know that jQuery is already on the page you can instruct Yii not to send it something like Yii::app()->clientScript->scriptMap[‘jQuery.js’] = false; …

Anyways I regress - your issue is likely the first item…

nz

Thank you for replying.

Indeed it seems to be the same issue.

I thought it could have a workaround. Until there is a fix, I think I have to do the same job than the component (for JS & CSS) in my controller.