You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dfom <da...@gefommt.de> on 2013/02/21 17:41:36 UTC
[T5.3.6] combining JSON response and zone update
I need to respond to an AJAX request with
1. a standard tapestry zone update combined with
2. a JSONArray response.
Is there a "best practice" to achieve this?
Some background: I use a form to set a filter. The form's zone should
update. Additionally the server has to send a then filtered JSONArray to be
processed with js on client side. So, the form data has to be present on the
server to filter the JSONArray. Synchronized ajax...? I'm a little bit
confused.
Thank you in advance!
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-6-combining-JSON-response-and-zone-update-tp5720149.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.3.6] combining JSON response and zone update
Posted by dfom <da...@gefommt.de>.
Ok. I found the solution by myself.
Just added a js callback to the zone update response. The callback function
now sends a second request responding the json array.
Don't know if this is "best practice" but it's working...
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-6-combining-JSON-response-and-zone-update-tp5720149p5720172.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.3.6] combining JSON response and zone update
Posted by Ville <vi...@orientimport.fi>.
Take a look at AjaxResponseRenderer
(http://tapestry.apache.org/5.3.6/apidocs/org/apache/tapestry5/services/ajax/AjaxResponseRenderer.html)
It can be used to add as many zone, json etc. responses in one request to
the client.
Example:
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/multiplezoneupdate
A comment from Howard:
(http://tapestry.1045711.n5.nabble.com/Howto-render-a-block-and-put-it-into-a-JSON-reply-tp5486823p5717889.html)
"In an Ajax request, returning a JSONObject is completely appropriate return
value from a component event that expects a page navigation result. This
will mix-and-match well with AjaxResponseRenderer (under 5.3 and 5.4); that
is, you can return a JSONObject and Tapestry will add to it the keys for
zone updates and page initializations related to rendering Blocks and Zones.
Under 5.4, it's a bit neater, with the partial page render response values
buried down a level under a "_tapestry" key. "
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-6-combining-JSON-response-and-zone-update-tp5720149p5720174.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org