RenderPartial and JS events

Hi, all.

I use nyroModal jQuery plugin for creating "modal" Window in my application.

And I want to get working this piece of code, inside modal Window.




<?php echo CHtml::linkButton('Send',array(

'href' => 'add/comment',

'submit'=>'add/comment',

'type'=>'POST',

'csrf' => true,

'return' => false,

'update' => '#commentBlock',)

); ?>



For this purpose I have used renderPartial with processOutput set to TRUE

But there is a small problem… When I use code as above, Yii try to include

this file "jQuery Yii plugin file" - jquery.yii.js.

But nyroModal do not include any external script file while loading.

I can change this behaviour setting some attribute to tag script.

But my problem is - I do not include jquery.yii.js by my self, it has already included

automaticaly. So i have no any place where I should add those attrubutes.

Also I could include this file manualy with help registerScriptFile function, but it’s does not get me any chance to add any attribute to tag script.

Have you any ideas how to solv this problem ?

Thanks.

Try this




Yii:app()->clientcScript->scriptMap('*.js');

or

Yii:app()->clientcScript->scriptMap('jquery.yii.js');



/Tommy

Hi Tommy thanks for you answer but I think it’s wrong.

  1. ScriptMap is not a function. it’s a property and your code does not working at all.

  2. I never used ScriptMap before, and that is why I don’t understand how to use it correctly.

and also how it could help me ?

I just saying what nyroModal ignore any external js script files.

And if i want break this behavior, I should add to script tag some atribute

http://nyromodal.nyrodev.com/wiki/index.php/Deal_with_JavaScript_in_an_Ajax_loaded_page

How you advice could help me ?

Thanks.

Perhaps i didn’t understand your question. With scriptmap(*.js) in your ajax action you can prevent the core scripts from loading more than once (if that’s what you want to accomplish).

/Tommy

I have decide to solve my problem like this:





<script type="text/javascript" charset="utf-8">

<?php

include "".Yii::getPathOfAlias('system.web.js.source')."/jquery.yii.js";

?>

</script>