Re: Preload js after block update
On Fri, 21 Sep 2012 05:54:27 -0300, rosecorp wrote: Thank you Ivan, that suggestion is very useful, I will try to refactor my solutions this night. Thanks a lot! Ivan suggested exactly the same solution as me, but with a better explanation. Thanks Ivan! :) -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Preload js after block update
If you need to load all scripts when page is loaded just place @Import annotation to your page java class. There is no way to make it dynamicly as components placed in block are not rendered and as result doesn't add their scripts to page. You need to specify all scripts explicitly. Or you can try to create your own hack that will render your block and then remove it: public class DirtyHack { @Parameter(required = true, defaultPrefix = BindingConstants.BLOCK) private Block block; @Mixin private DiscardBody discardBody; private Element element; @BeginRender Object begin(final MarkupWriter writer) { element = writer.element("placeholder"); return block; } @AfterRender void end(final MarkupWriter writer) { writer.end(); element.remove(); } } ... But I not recommend this hack as it will render all hidden components markup for every page request. Just specify all scrips in page @Import explicitly. On Fri, Sep 21, 2012 at 11:18 AM, rosecorp wrote: > Hi Thiago, > > Maybe I wasn't clear in my first post. I will paraphrase my problem. > > I am using tapestry5-jquery and there is a use case where I load page with > 3 > different options to choose which are event links and then I handle it in > java code to render particular block. The problem is that one of those > blocks contain several of complicated component like file upload, > accordions > etc. and I see in Firebug that all js are being loaded after ajax call > which > is not very nice for user experience. At the moment I have sorted this > problem basically to load those components once page has been loaded in a > hidden div and then after ajax call I will show up those hidden divs but I > think this solutions is nasty. Is there any better way to do this? > > Thanks in advance and sorry for a long explanation. > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Preload-js-after-block-update-tp5716410p5716425.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- BR Ivan
Re: Preload js after block update
Hi Thiago, Maybe I wasn't clear in my first post. I will paraphrase my problem. I am using tapestry5-jquery and there is a use case where I load page with 3 different options to choose which are event links and then I handle it in java code to render particular block. The problem is that one of those blocks contain several of complicated component like file upload, accordions etc. and I see in Firebug that all js are being loaded after ajax call which is not very nice for user experience. At the moment I have sorted this problem basically to load those components once page has been loaded in a hidden div and then after ajax call I will show up those hidden divs but I think this solutions is nasty. Is there any better way to do this? Thanks in advance and sorry for a long explanation. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Preload-js-after-block-update-tp5716410p5716425.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Preload js after block update
On Thu, 20 Sep 2012 18:18:13 -0300, rosecorp wrote: Hi Guys, Hi! I have a block element in tml which contains other components with heavy js content. Is it possible to pre-load those java script files before zone update? Why don't you just use @Import to load these JavaScript files? You know you're going to use them anyway . . . -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org