You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by grabarz <um...@gazeta.pl> on 2009/04/14 23:37:51 UTC

T5 how to execute javascript after zone update?

is there any way to execute custom piece of javascript after zone
update? inside tapestry.js i found:

    loadScriptsInReply : function(reply, callback)

     * Passed the JSON content of a Tapestry partial markup response, extracts
     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
     * then the callback is invoked.

and indeed it tries to evaluate passed script:

      if (reply.script) eval(reply.script);

the question is, how to inject my javascript into reply?

cheers,
m.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 how to execute javascript after zone update?

Posted by Howard Lewis Ship <hl...@gmail.com>.
There's now an event you can observe that gets triggered just after
the content of the zone is updated. The event is fired on the Zone's
<div> element. See the nightly docs (Zone component reference) for
details.

On Wed, Apr 15, 2009 at 1:46 AM, Hugo Palma <hu...@gmail.com> wrote:
> There was a discussion on the list recently regarding this subject (
> http://www.nabble.com/Executing-javascript-on-ajax-call-return-td22667258.html
> ).
> An issue was created for this, you can watch/vote for it here
> https://issues.apache.org/jira/browse/TAP5-624
>
> 2009/4/14 grabarz <um...@gazeta.pl>
>
>> is there any way to execute custom piece of javascript after zone
>> update? inside tapestry.js i found:
>>
>>    loadScriptsInReply : function(reply, callback)
>>
>>     * Passed the JSON content of a Tapestry partial markup response,
>> extracts
>>     * the script and stylesheet information.  JavaScript libraries and
>> stylesheets are loaded,
>>     * then the callback is invoked.
>>
>> and indeed it tries to evaluate passed script:
>>
>>      if (reply.script) eval(reply.script);
>>
>> the question is, how to inject my javascript into reply?
>>
>> cheers,
>> m.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 how to execute javascript after zone update?

Posted by Hugo Palma <hu...@gmail.com>.
There was a discussion on the list recently regarding this subject (
http://www.nabble.com/Executing-javascript-on-ajax-call-return-td22667258.html
).
An issue was created for this, you can watch/vote for it here
https://issues.apache.org/jira/browse/TAP5-624

2009/4/14 grabarz <um...@gazeta.pl>

> is there any way to execute custom piece of javascript after zone
> update? inside tapestry.js i found:
>
>    loadScriptsInReply : function(reply, callback)
>
>     * Passed the JSON content of a Tapestry partial markup response,
> extracts
>     * the script and stylesheet information.  JavaScript libraries and
> stylesheets are loaded,
>     * then the callback is invoked.
>
> and indeed it tries to evaluate passed script:
>
>      if (reply.script) eval(reply.script);
>
> the question is, how to inject my javascript into reply?
>
> cheers,
> m.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5 how to execute javascript after zone update?

Posted by DH <ni...@gmail.com>.
Not yet, thanks for remind, I will try soon. If so, cool.

Thanks,
DH


----- Original Message ----- 
From: "Fernando Padilla" <fe...@alum.mit.edu>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, April 15, 2009 11:19 AM
Subject: Re: T5 how to execute javascript after zone update?


> did you try @Environmental?
> 
> 
> DH wrote:
>> I remember @Inject RenderSupport is not available in ajax action request even though in latest snapshot,  I just tried several days ago and got error. 
>> 
>> Thanks
>> DH
>> 
>> 
>> ----- Original Message ----- 
>> From: "Fernando Padilla" 
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Wednesday, April 15, 2009 10:16 AM
>> Subject: Re: T5 how to execute javascript after zone update?
>> 
>> 
>>> You use the normal RenderSupport.addScript(..) method.  And tapestry 
>>> adds it to the json response, and it gets executed by loadScriptsInReply...
>>>
>>> DH wrote:
>>>> 1. If your return is Block or Zone, just put <script>...</script> inside the block or zone.
>>>> 2. If return is JSONObject, can do like this: 
>>>>     JSONObject response = new JSONObject();
>>>>     response.put("script", "alert('ff');"); 
>>>>     return response;
>>>>
>>>> Thanks,
>>>> DH
>>>>
>>>>
>>>> ----- Original Message ----- 
>>>> From: "grabarz" <um...@gazeta.pl>
>>>> To: <us...@tapestry.apache.org>
>>>> Sent: Wednesday, April 15, 2009 5:37 AM
>>>> Subject: T5 how to execute javascript after zone update?
>>>>
>>>>
>>>>> is there any way to execute custom piece of javascript after zone
>>>>> update? inside tapestry.js i found:
>>>>>
>>>>>    loadScriptsInReply : function(reply, callback)
>>>>>
>>>>>     * Passed the JSON content of a Tapestry partial markup response, extracts
>>>>>     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
>>>>>     * then the callback is invoked.
>>>>>
>>>>> and indeed it tries to evaluate passed script:
>>>>>
>>>>>      if (reply.script) eval(reply.script);
>>>>>
>>>>> the question is, how to inject my javascript into reply?
>>>>>
>>>>> cheers,
>>>>> m.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: T5 how to execute javascript after zone update?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
did you try @Environmental?


DH wrote:
> I remember @Inject RenderSupport is not available in ajax action request even though in latest snapshot,  I just tried several days ago and got error. 
> 
> Thanks
> DH
> 
> 
> ----- Original Message ----- 
> From: "Fernando Padilla" 
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Wednesday, April 15, 2009 10:16 AM
> Subject: Re: T5 how to execute javascript after zone update?
> 
> 
>> You use the normal RenderSupport.addScript(..) method.  And tapestry 
>> adds it to the json response, and it gets executed by loadScriptsInReply...
>>
>> DH wrote:
>>> 1. If your return is Block or Zone, just put <script>...</script> inside the block or zone.
>>> 2. If return is JSONObject, can do like this: 
>>>     JSONObject response = new JSONObject();
>>>     response.put("script", "alert('ff');"); 
>>>     return response;
>>>
>>> Thanks,
>>> DH
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "grabarz" <um...@gazeta.pl>
>>> To: <us...@tapestry.apache.org>
>>> Sent: Wednesday, April 15, 2009 5:37 AM
>>> Subject: T5 how to execute javascript after zone update?
>>>
>>>
>>>> is there any way to execute custom piece of javascript after zone
>>>> update? inside tapestry.js i found:
>>>>
>>>>    loadScriptsInReply : function(reply, callback)
>>>>
>>>>     * Passed the JSON content of a Tapestry partial markup response, extracts
>>>>     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
>>>>     * then the callback is invoked.
>>>>
>>>> and indeed it tries to evaluate passed script:
>>>>
>>>>      if (reply.script) eval(reply.script);
>>>>
>>>> the question is, how to inject my javascript into reply?
>>>>
>>>> cheers,
>>>> m.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 how to execute javascript after zone update?

Posted by DH <ni...@gmail.com>.
I remember @Inject RenderSupport is not available in ajax action request even though in latest snapshot,  I just tried several days ago and got error. 

Thanks
DH


----- Original Message ----- 
From: "Fernando Padilla" 
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, April 15, 2009 10:16 AM
Subject: Re: T5 how to execute javascript after zone update?


> You use the normal RenderSupport.addScript(..) method.  And tapestry 
> adds it to the json response, and it gets executed by loadScriptsInReply...
> 
> DH wrote:
>> 1. If your return is Block or Zone, just put <script>...</script> inside the block or zone.
>> 2. If return is JSONObject, can do like this: 
>>     JSONObject response = new JSONObject();
>>     response.put("script", "alert('ff');"); 
>>     return response;
>> 
>> Thanks,
>> DH
>> 
>> 
>> ----- Original Message ----- 
>> From: "grabarz" <um...@gazeta.pl>
>> To: <us...@tapestry.apache.org>
>> Sent: Wednesday, April 15, 2009 5:37 AM
>> Subject: T5 how to execute javascript after zone update?
>> 
>> 
>>> is there any way to execute custom piece of javascript after zone
>>> update? inside tapestry.js i found:
>>>
>>>    loadScriptsInReply : function(reply, callback)
>>>
>>>     * Passed the JSON content of a Tapestry partial markup response, extracts
>>>     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
>>>     * then the callback is invoked.
>>>
>>> and indeed it tries to evaluate passed script:
>>>
>>>      if (reply.script) eval(reply.script);
>>>
>>> the question is, how to inject my javascript into reply?
>>>
>>> cheers,
>>> m.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: T5 how to execute javascript after zone update?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
You use the normal RenderSupport.addScript(..) method.  And tapestry 
adds it to the json response, and it gets executed by loadScriptsInReply...

DH wrote:
> 1. If your return is Block or Zone, just put <script>...</script> inside the block or zone.
> 2. If return is JSONObject, can do like this: 
>     JSONObject response = new JSONObject();
>     response.put("script", "alert('ff');"); 
>     return response;
> 
> Thanks,
> DH
> 
> 
> ----- Original Message ----- 
> From: "grabarz" <um...@gazeta.pl>
> To: <us...@tapestry.apache.org>
> Sent: Wednesday, April 15, 2009 5:37 AM
> Subject: T5 how to execute javascript after zone update?
> 
> 
>> is there any way to execute custom piece of javascript after zone
>> update? inside tapestry.js i found:
>>
>>    loadScriptsInReply : function(reply, callback)
>>
>>     * Passed the JSON content of a Tapestry partial markup response, extracts
>>     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
>>     * then the callback is invoked.
>>
>> and indeed it tries to evaluate passed script:
>>
>>      if (reply.script) eval(reply.script);
>>
>> the question is, how to inject my javascript into reply?
>>
>> cheers,
>> m.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 how to execute javascript after zone update?

Posted by DH <ni...@gmail.com>.
1. If your return is Block or Zone, just put <script>...</script> inside the block or zone.
2. If return is JSONObject, can do like this: 
    JSONObject response = new JSONObject();
    response.put("script", "alert('ff');"); 
    return response;

Thanks,
DH


----- Original Message ----- 
From: "grabarz" <um...@gazeta.pl>
To: <us...@tapestry.apache.org>
Sent: Wednesday, April 15, 2009 5:37 AM
Subject: T5 how to execute javascript after zone update?


> is there any way to execute custom piece of javascript after zone
> update? inside tapestry.js i found:
> 
>    loadScriptsInReply : function(reply, callback)
> 
>     * Passed the JSON content of a Tapestry partial markup response, extracts
>     * the script and stylesheet information.  JavaScript libraries and stylesheets are loaded,
>     * then the callback is invoked.
> 
> and indeed it tries to evaluate passed script:
> 
>      if (reply.script) eval(reply.script);
> 
> the question is, how to inject my javascript into reply?
> 
> cheers,
> m.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>