I can’t seem to register scripts on a partial view. A test of this
<?php Yii::app()->clientScript->registerScript(‘test’, “var js=‘123’”,CClientScript::POS_BEGIN); ?>
works on actionIndex render but does not work on renderPartial after an ajax call. I have process output set to true. Any idea how I register scripts on a partial view?
You should not try to register scripts on pages that are loaded via Ajax. The script must be registered your non Ajaxed page, eg. the main layout.
It would have made sense if you would add some arguments for this opinion.
On topic: you will have to set the parameter processOutput of renderPartial to true, e.g.:
$this->renderPartial('nameOfTheView', array('foo' => 'bar'), false, true);