Re: Ajax.Request to handle a multizone update?
Howard, where can I find it in 5.2? (js method name) I'd like to write some forwards compatibility so i don't forget when we upgrade... Howard Lewis Ship wrote: I've extracted the body of 'Tapestry.loadScriptsInReply' and called that with the parameter 'transport.responseJSON'. This works well, however it would be good to not have to copy and paste code the tapestry. I will log a jira requesting the body of Tapestry.loadScriptsInReply be exposed as its own top level function for adequate re-use. You're a little late on that, it's already in 5.2 (for other reasons).
Ajax.Request to handle a multizone update?
Hi all, I've set up an Ajax.Request to call a listener method in my component. The listener method returns a MultiZoneUpdate. return new MultiZoneUpdate(myZone, myZone); // this will update more zones once I get it working My question is, what do I have to do in my onComplete (or onSucess) handler in the Ajax.Request to actually perform the zone updates on the client? Or is there a better method of calling and handling an event listener which returns a MultiZoneUpdate than Ajax.Request? Thanks, p. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Ajax.Request to handle a multizone update?
Hi, in a page I would do the following (not really sure if you may apply this in a component, however I see no reason why you shouldn't be able to do this): 1. Include an eventlink (even if you don't want the ajax update to be invoked by means of clicking the link, include it and hide it with display:none) t:eventlink t:id=ajaxUpdate id=ajaxUpdate zone=ajaxZone1 style=display:none/t:eventlink t:zone t:id=ajaxZone1 id=ajaxZone1.../t:zone t:zone t:id=ajaxZone2 id=ajaxZone2.../t:zone 2. If you want to invoke this through javascript use the following javascript statement: $T('ajaxZone1').zoneManager.updateFromURL($('ajaxUpdate').href); I obtain tapestry's zone manager for the zone and invoke updateFromURL using the url formatted by tapestry in the event link. 3. (obviously :)) handle the event in your code just like you do, returning a multi zone update object. Tapestry's js handles the zone updates once the ajax response is received on the client side. This has been working fine for me, you may want to have a look in tapestry.js - the implementation of updateFromURL will show you the next steps tapestry is going through to update the zones on the client-side. Cheers, Vassilis On 18/05/10 10:27, Paul Stanton wrote: Hi all, I've set up an Ajax.Request to call a listener method in my component. The listener method returns a MultiZoneUpdate. return new MultiZoneUpdate(myZone, myZone); // this will update more zones once I get it working My question is, what do I have to do in my onComplete (or onSucess) handler in the Ajax.Request to actually perform the zone updates on the client? Or is there a better method of calling and handling an event listener which returns a MultiZoneUpdate than Ajax.Request? Thanks, p. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Ajax.Request to handle a multizone update?
Thanks Vassilis, The key was in the javascript function processReply processReply : function(reply) { Tapestry.loadScriptsInReply(reply, function() { // In a multi-zone update, the reply.content may be blank or missing. reply.content this.show(reply.content); // zones is an object of zone ids and zone content that will be present // in a multi-zone update response. Object.keys(reply.zones).each(function (zoneId) { var manager = Tapestry.findZoneManagerForZone(zoneId); if (manager) { var zoneContent = reply.zones[zoneId]; manager.show(zoneContent); } }); }.bind(this)); }, I've extracted the body of 'Tapestry.loadScriptsInReply' and called that with the parameter 'transport.responseJSON'. This works well, however it would be good to not have to copy and paste code the tapestry. I will log a jira requesting the body of Tapestry.loadScriptsInReply be exposed as its own top level function for adequate re-use. Indeed, it would be handy to have a top level function that could detect and handle any type of tapestry ajax response. p. Vassilis Bekiaris wrote: Hi, in a page I would do the following (not really sure if you may apply this in a component, however I see no reason why you shouldn't be able to do this): 1. Include an eventlink (even if you don't want the ajax update to be invoked by means of clicking the link, include it and hide it with display:none) t:eventlink t:id=ajaxUpdate id=ajaxUpdate zone=ajaxZone1 style=display:none/t:eventlink t:zone t:id=ajaxZone1 id=ajaxZone1.../t:zone t:zone t:id=ajaxZone2 id=ajaxZone2.../t:zone 2. If you want to invoke this through javascript use the following javascript statement: $T('ajaxZone1').zoneManager.updateFromURL($('ajaxUpdate').href); I obtain tapestry's zone manager for the zone and invoke updateFromURL using the url formatted by tapestry in the event link. 3. (obviously :)) handle the event in your code just like you do, returning a multi zone update object. Tapestry's js handles the zone updates once the ajax response is received on the client side. This has been working fine for me, you may want to have a look in tapestry.js - the implementation of updateFromURL will show you the next steps tapestry is going through to update the zones on the client-side. Cheers, Vassilis On 18/05/10 10:27, Paul Stanton wrote: Hi all, I've set up an Ajax.Request to call a listener method in my component. The listener method returns a MultiZoneUpdate. return new MultiZoneUpdate(myZone, myZone); // this will update more zones once I get it working My question is, what do I have to do in my onComplete (or onSucess) handler in the Ajax.Request to actually perform the zone updates on the client? Or is there a better method of calling and handling an event listener which returns a MultiZoneUpdate than Ajax.Request? Thanks, p. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org