You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nathan Quirynen <na...@pensionarchitects.be> on 2016/02/05 14:54:46 UTC
[5.4] request from javascript to Tapestry event
Hi,
I have finally started the process of updating to 5.4.
Some components have an initializer javascript where an eventlink url is
passed as a parameter to be used as the url for a request from
javascript to a Tapestry event.
To handle the response (zone updates, scripts, ..) I added in the
request callback function the following:
$.get(spec.eventLink, function(r) {
if (r.zones) {
$.each(r.zones, function(zoneId){
$('#' + zoneId).tapestryZone("applyContentUpdate",
r.zones[zoneId]);
});
}
if (r.updateZone) {
var spec = {
url: r.updateZone.url,
params: r.updateZone.params
};
$('#' + r.updateZone.zoneId).tapestryZone("update", spec);
}
$.tapestry.utils.loadScriptsInReply(r);
});
I thought this was not the best solution, but did not find another one
at the moment and it worked.
Now in 5.4 it does not work anymore, so how do I have to fire requests
to tapestry events from javascript and make it handle the response?
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [5.4] request from javascript to Tapestry event
Posted by Chris Poulsen <ma...@nesluop.dk>.
Faking a "click" on an invisible async eventlink could also be a very
simple way to get this working without having to mock around with much
javascript.
--
Chris
On Fri, Feb 5, 2016 at 3:04 PM, Chris Poulsen <ma...@nesluop.dk>
wrote:
> Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html
>
> --
> Chris
>
> On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen <
> nathan@pensionarchitects.be> wrote:
>
>> Hi,
>>
>> I have finally started the process of updating to 5.4.
>> Some components have an initializer javascript where an eventlink url is
>> passed as a parameter to be used as the url for a request from javascript
>> to a Tapestry event.
>> To handle the response (zone updates, scripts, ..) I added in the request
>> callback function the following:
>>
>> $.get(spec.eventLink, function(r) {
>>
>> if (r.zones) {
>> $.each(r.zones, function(zoneId){
>> $('#' + zoneId).tapestryZone("applyContentUpdate",
>> r.zones[zoneId]);
>> });
>> }
>>
>> if (r.updateZone) {
>> var spec = {
>> url: r.updateZone.url,
>> params: r.updateZone.params
>> };
>> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
>> }
>> $.tapestry.utils.loadScriptsInReply(r);
>>
>> });
>>
>> I thought this was not the best solution, but did not find another one at
>> the moment and it worked.
>> Now in 5.4 it does not work anymore, so how do I have to fire requests to
>> tapestry events from javascript and make it handle the response?
>>
>> Nathan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
Re: [5.4] request from javascript to Tapestry event
Posted by Nathan Quirynen <na...@pensionarchitects.be>.
Thanks for the link.
I think I fixed it adding just the following in my request callback
function:
pageinit.handlePartialPageRenderResponse({ json : r });
On 05/02/16 15:04, Chris Poulsen wrote:
> Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [5.4] request from javascript to Tapestry event
Posted by Chris Poulsen <ma...@nesluop.dk>.
Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html
--
Chris
On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen <nathan@pensionarchitects.be
> wrote:
> Hi,
>
> I have finally started the process of updating to 5.4.
> Some components have an initializer javascript where an eventlink url is
> passed as a parameter to be used as the url for a request from javascript
> to a Tapestry event.
> To handle the response (zone updates, scripts, ..) I added in the request
> callback function the following:
>
> $.get(spec.eventLink, function(r) {
>
> if (r.zones) {
> $.each(r.zones, function(zoneId){
> $('#' + zoneId).tapestryZone("applyContentUpdate",
> r.zones[zoneId]);
> });
> }
>
> if (r.updateZone) {
> var spec = {
> url: r.updateZone.url,
> params: r.updateZone.params
> };
> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
> }
> $.tapestry.utils.loadScriptsInReply(r);
>
> });
>
> I thought this was not the best solution, but did not find another one at
> the moment and it worked.
> Now in 5.4 it does not work anymore, so how do I have to fire requests to
> tapestry events from javascript and make it handle the response?
>
> Nathan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>