Yep, we need a proper guide for this... till then I bet you're looking at
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java
The idea is that if a component implements IJSONRender and a
json render is executing that includes it, then the component's
void renderComponent(IJSONWriter writer, IRequestCycle cycle);
is going to get called. See what the Autocompleter does to find out how
to add
data to the writer.
Now, when the response comes in, tapestry.loadJson is called... By
default this doesn't do anything.
So, how do you use the data then?
I see two options:
-) Attach a custom function on tapestry.loadJson, so that you can do
whatever you want there (hint: dojo.event.connect).
-) Create a client-side widget that fetches json data on its own and
pass it the url that creates that data. The DirectService
can create that url for you (see the Autocompleter widget).
Portuendo Vestado wrote:
Hello,
I'm looking for a proper way of using built-in Ajax support in T 4.1.1, and
having a bit of a trouble with the following scenario.
I'm trying to push json back down to the client after using DirectLink's (or
any other IDynamicInvoker, e.g. Form) json="true" parameter, or some other
option, like @EventListener. I can't seem to figure out how I could get the
listener method to build json object to return. Also, once the object is
returned, how would I specify a callback function on the client side to deal
with returned data?
T 4.1.1 does make it simple to reload any components after the asynch
request (updateComponents param), but sometimes you want something simpler,
like sending back some data so browser can take care of any changes on
client-side, without having to reload an entire component. I guess I'm
looking for the simplest and most correct way in T4 of implementing JSON-RPC
(http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9).
Is there any documentation/articles on T's Ajax, which could help me with
this or any other related cases? I'm basically using the source code as the
guide, but in this way figuring out even simplest things takes a while.
Thanks!
___
Yahoo! Mail - Sempre a melhor opção para você!
Experimente já e veja as novidades.
http://br.yahoo.com/mailbeta/tudonovo/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]