On Tue, 21 Aug 2012 09:24:10 -0300, llama-king <p.hv...@albourne.com>
wrote:
Hi Thiago!
Hi!
Thanks for the reply.
The outset is I'm writing a mixin that allows binding of client-side
jQuery
events to server-side handler methods.
1. I create a Link via ComponentResources.createEventLink and pass the
absolute URI to my mixin script as well as the name of the jQuery event I
want to intercept and the id of the client element.
2. The mixin script listens for the jQuery event on the client element
and
then fires off an ajax request via jQuery.ajax().
3. My server side event handler method in my mixin class then triggers
which
in turn triggers an event (via component resources) of the same name as
the
jQuery event as well as pumps in any context and the
ComponentEventCallback.
4. The component that utilizes the mixin declares an event handler method
which sets a value from the context and then returns a zone_.getBody().
Everything until here seems correct to me.
5. The correct EventResultProcessor triggers (in my test code I'm
coercing the zone_.getBody() block into a RenderCommand as I'm not sure
if Block is being picked up according to a quick glance at
TapestryModule).
AFAIK, you actually don't need to do this coercion, as Tapestry blocks are
BlockImpl instances, which implement RenderCommand already.
In the debugger I can see that
RenderCommandComponentEventResultProcessor's
renderMarkup method is called and packs the correct mark-up into the
response. Beyond that I am unsure what's going on; no partial render
occurs even though the belying source leads me to believe it should have
occured.
Have you checked the responde in Firebug or similar tool?
Anyway, if you want to update a zone, you shouldn't use jQuery.ajax()
directly, but use the ZoneManager JavaScript class instead.
This has left me scratching my head. I wonder whether I'm doing something
silly somewhere but nevertheless it has been a very fun mixin to try to
write!
Yay for fun-to-write mixins! :) Will you share this code with us when it's
done?
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org