Widget jQuery at Bottom of View

Hey all,

I’m rendering a view file that contains XML. The problem I have is that when an XML entity represents a chunk of a view that contains a widget (CStarRating in my case), the renderer puts the resultant jQuery after the last XML entity and the XML becomes malformed. This works with HTML views because the jQuery lines get placed just before the </body> tag. Since there is no body tag in the XML document, it’s going to the very end.

So I though I would try to make a custom renderer but realized I would have the same problem since the placement seems to be controlled from outside the renderer.

I looked around the framework but didn’t see what code places the jQuery lines at the end of the rendered view, probably because I don’t really know what I’m looking for or where it would be (it’s not in the related widget code that I can see but not sure I would recognize it even if I saw it).

How can I get those jQuery lines to go in an appropriate place based on the type of document being rendered?

Thanks for any help, it’s greatly appreciated.

See the documentation

some example :




Yii::app()->clientScript->registerScriptFile('/assets/jquerypopup.js', 2);



0 = POS_HEAD

1 = POS_BEGIN

2 = POS_END

try search that code on your include extension.

hope help… :(

That is a really interesting question, drech.

Often I have problem with Ajax refresh, because I cannot understand how to render the clientScript.

If I call a renderPartial(‘view’, $params) the script of the components INSIDE the refreshed view are not working, if I call a renderPartial(‘view’, $params, false, true) the script of the compoent inside the refreshed view works correctly, but the components outside don’t works.

I guess should be fine to have a CClientScript::renderHere() that simply write out all clientScript where is called.

That allows to render the script in the refreshed subview (or xml node).

Is it possible to to do with the actual instruments?

If yes can someone explain? If not can be a feature?

yess, i got this problem too, very tired to debug ‘whats going on’.


renderPartial('view', $params, false, true)

try another options, but still the same problem appear and another problem soon appears.

especially when you works on cgridview, and mix the apllication with ajax paging, search, sort, and included onother jquery extension.

i hope somebody can explain this… :blink: