You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2011/11/15 08:19:35 UTC

IncludeJavaScriptLibrary doesn't work if component is included later

Hi all,

I'm still using T5.1, so please keep that in mind...

I have a component which is hidden (via a t:loop which starts with zero 
elements) at the initial page render.

Later, via ajax/zone updates, the t:loop is reloaded with elements, each 
of which create an instance of my component.

The component needs some javascript loaded, which I'm trying to achieve 
via @IncludeJavaScriptLibrary however I've found that the JS file is 
never embedded, since it seems this is only interegated at the initial 
page load.

One solution would be to include the JS in the container (page) however 
this breaks the nice model of inclusion by direct owner.

Is there a way to include the JS when the component is first rendered?

or is there a way to always include the JS when the containing page is 
first rendered, whether the component is currently excluded by logic or not?

Thanks, Paul.

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


Re: IncludeJavaScriptLibrary doesn't work if component is included later

Posted by Paul Stanton <pa...@mapshed.com.au>.
my mistake! i had a syntax error in the js. IncludeJavaScriptLibrary 
works as expected!

On 15/11/2011 6:19 PM, Paul Stanton wrote:
> Hi all,
>
> I'm still using T5.1, so please keep that in mind...
>
> I have a component which is hidden (via a t:loop which starts with 
> zero elements) at the initial page render.
>
> Later, via ajax/zone updates, the t:loop is reloaded with elements, 
> each of which create an instance of my component.
>
> The component needs some javascript loaded, which I'm trying to 
> achieve via @IncludeJavaScriptLibrary however I've found that the JS 
> file is never embedded, since it seems this is only interegated at the 
> initial page load.
>
> One solution would be to include the JS in the container (page) 
> however this breaks the nice model of inclusion by direct owner.
>
> Is there a way to include the JS when the component is first rendered?
>
> or is there a way to always include the JS when the containing page is 
> first rendered, whether the component is currently excluded by logic 
> or not?
>
> Thanks, Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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