You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joe Klecko <bu...@gmail.com> on 2011/03/09 22:04:36 UTC

Re: Rendering a Block

>> provide more details. Anyway, there isn't a ready made way of rendering a  
>> block to a string. Please file a JIRA about it. Meanwhile, this message
>> in  
>> the mailing list provide a way of doing exactly what you want:  
>> http://www.mail-archive.com/users@.../msg38854.html. It's  
>> not beautiful, but works. :) 

I'm running into a different use case along the same lines where I need to
render a block into a string.   For reference here is a JIRA created in Dec
2009 for using non T5 services to render a block: 
https://issues.apache.org/jira/browse/TAP5-938

Please vote!


Thiago, the thread you mention implies it only works if you do not use any
t5 components in the block.  This thread is from 2009 and a lot has changed
internally ... so have you or anyone else been successful in rendering a
block into a string or can someone point me in the right direction to doing
this with T5.2?   I would be more than happy to post the solution if I can
just get an "up to date" kick start. :-)

thanks,
B




--
View this message in context: http://tapestry.1045711.n5.nabble.com/Rendering-a-Block-tp3401393p3416263.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: Rendering a Block

Posted by Howard Lewis Ship <hl...@gmail.com>.
You don't necessarily need a zone, just combine

Tapestry.ajaxRequest()

with

Tapestry.loadScriptsInReply()

Example:

Tapestry.ajaxRequest(spec.url, function (transport) {

  var reply = transport.responseJSON;

  Tapestry.loadScriptsInReply(reply, function() {
    $(myDiv).update(reply.content);
   });
});

The key part is the loadScriptsInReply() function, which is what
understands Tapestry's partial page render response, which is the JSON
object that will be sent to the client when you render your
server-side Block.

Remember that rendering is more than just a stream of HTML: there's
also JavaScript libraries and CSS files that may be imported by
components inside the block, plus any client-side JavaScript
initializations that must occur.  All of that is handled by Tapestry's
Zone component normally, because it used loadScriptsInReply() as well.

Documenting all of this (beyond what's in comments in the JavaScript
source) is a big part of what's going to be going on in 5.3 and 5.4
... along with other changes to support different infrastructures
(that is, Prototype or jQuery or maybe others, such as ExtJS, etc.).


On Wed, Mar 9, 2011 at 1:04 PM, Joe Klecko <bu...@gmail.com> wrote:
>>> provide more details. Anyway, there isn't a ready made way of rendering a
>>> block to a string. Please file a JIRA about it. Meanwhile, this message
>>> in
>>> the mailing list provide a way of doing exactly what you want:
>>> http://www.mail-archive.com/users@.../msg38854.html. It's
>>> not beautiful, but works. :)
>
> I'm running into a different use case along the same lines where I need to
> render a block into a string.   For reference here is a JIRA created in Dec
> 2009 for using non T5 services to render a block:
> https://issues.apache.org/jira/browse/TAP5-938
>
> Please vote!
>
>
> Thiago, the thread you mention implies it only works if you do not use any
> t5 components in the block.  This thread is from 2009 and a lot has changed
> internally ... so have you or anyone else been successful in rendering a
> block into a string or can someone point me in the right direction to doing
> this with T5.2?   I would be more than happy to post the solution if I can
> just get an "up to date" kick start. :-)
>
> thanks,
> B
>
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Rendering-a-Block-tp3401393p3416263.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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org