Ok, understand that, but is the response.js should allow me to insert this
in my view :
<script type="text/javascript"> $(".chzn-select").chosen(); </script>
Is there a way to insert a script into a view from controller... It may be
consider script injection I don't know...
Richard
On Tue, Feb 21, 2012 at 4:59 PM, Anthony <[email protected]> wrote:
> Is response.files being set by the component action, or by the page that
> contains the component? If the former, it won't work, as response.files is
> ignored when set in a component (response.files is used by layout.html to
> include CSS and JS files in the document head and so is ignored by
> components, which do not load a full page and therefore do not contain a
> head).
>
> Anthony
>
>
> On Tuesday, February 21, 2012 4:48:51 PM UTC-5, Richard wrote:
>>
>> Hello,
>>
>> Why I can't get initialization jquery plugin code to be execute by
>> view?
>>
>> # Controller
>> response.js="""$(".chzn-**select").chosen();"""
>>
>> I already append(pluging file and css) like this :
>>
>> response.files.append(URL('**static','plugin_added/**harvesthq-
>> chosen-ada808d/chosen/chosen.**css'))
>> response.files.append(URL('**static','plugin_added/**harvesthq-
>> chosen-ada808d/chosen/chosen.**jquery.js'))
>>
>> I know those works...
>>
>> In the book at in core chapter is says this :
>>
>> response.js can contain Javascript Code. This code will be executed if
>> and only if the response is received by a web2py component as
>> discussed in Chapter 12.
>>
>> In chapter 12, there is this example :
>>
>> response.js = "jQuery('#%s').hide()" % request.cid
>>
>> Thanks
>>
>> Richard
>>
>