You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Magnus Kvalheim <ma...@kvalheim.dk> on 2009/12/10 16:47:14 UTC

Render block for Ajax component

Hi all,

I'm trying to integrate thirdparty ajax libraries with Tapestry (5.1.0.5).
These libraries uses Ajax.Request for getting content.
Instead of getting a (whole) page, I'm trying to call an actionlink and
return a block defined in the template.

Many ajax libraries for showing a modal or tooltip uses the notation:
new Tip(element, {
ajax: {
  url: '/page.htm'
}
});

My question is: Is it possible to 'render' the block in the onAction method
and return that? Perhaps as StreamResponse instead of returning block
itself(JSON hash)?


Thanks
Magnus

Re: Render block for Ajax component

Posted by Magnus Kvalheim <ma...@kvalheim.dk>.
Ok, this is what I have so far:
1. Component that generates eventlink and adds javascript for ajax request.
2. Once ajax is invoked it will call the event method on parent
component(page)
3. Event method returns block and the result is shown in modal/tooltip

What's shown in the client is the json response.
{"content":"<h1>Hello world<\/h1>"}

The javascript library is obfuscated so I can't easily modify it :(

How can I return only the partial markup to client?

Any ideas?

2009/12/10 Magnus Kvalheim <ma...@kvalheim.dk>

> Hi all,
>
> I'm trying to integrate thirdparty ajax libraries with Tapestry (5.1.0.5).
> These libraries uses Ajax.Request for getting content.
> Instead of getting a (whole) page, I'm trying to call an actionlink and
> return a block defined in the template.
>
> Many ajax libraries for showing a modal or tooltip uses the notation:
> new Tip(element, {
> ajax: {
>   url: '/page.htm'
> }
> });
>
> My question is: Is it possible to 'render' the block in the onAction method
> and return that? Perhaps as StreamResponse instead of returning block
> itself(JSON hash)?
>
>
> Thanks
> Magnus
>