I've found where the JSON is built, and can't see a way to include a
script call anywhere in there.
So my first hacky inclination is to create a hidden zone who's innerHTML
will contain the javascript (which has been updated in the server side
event listener, and call it via something like
'eval(zone.element.innerHTML);'.
In order to get this to work, I need to understand tapestry.js >
ZoneManager.show:
show: function(content)
{
this.updateElement.update(content);
var func = this.element.visible() ? this.updateFunc : this.showFunc;
func.call(this, this.element, this.endcolor);
this.element.fire(Tapestry.ZONE_UPDATED_EVENT);
},
1. updates the innerHTML
2. then runs the show or update effect
3. fires Tapestry.ZONE_UPDATED_EVENT.
Therefore the most sensible place for me to place my handling code is in
an event listener for "Tapestry.ZONE_UPDATED_EVENT". Does anyone know
how to attach a listener for this event?
p.
Paul Stanton wrote:
Hi all,
I've recently come up with a solution for handling MultiZoneUpdate as
the response from an Ajax.Request.
I did this by creating the following javascript function and calling
it in Ajax.Request.onSuccess:
Tapestry.handleMultizoneUpdate = function (transport)
{
var reply = transport.responseJSON;
// copied from tapestry.js - ZoneManager.processReply
// apparently exposed in t5.2
Object.keys(reply.zones).each(function (zoneId) {
var manager = Tapestry.findZoneManagerForZone(zoneId);
if (manager) {
var zoneContent = reply.zones[zoneId];
manager.show(zoneContent);
}
});
};
Now I need to add the ability to execute a script, generated (or
values populated) by the server.
1. Where is the code that turns MultiZoneUpdate into JSON?
2. What is the best way to return a javascript snippet from a tapestry
event listener to the client and have it executed in an Ajax/XHR
environment?
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