Re: Executing JS function from component ONCE

2014-02-20 Thread lacko
Ladislav -- Původní zpráva -- Od: Thiago H de Paula Figueiredo Komu: Tapestry users Datum: 20. 2. 2014 0:05:09 Předmět: Re: Executing JS function from component ONCE "On Wed, 19 Feb 2014 18:48:02 -0300, wrote: > Hi! Hi! > var db =

Re: Executing JS function from component ONCE

2014-02-19 Thread Thiago H de Paula Figueiredo
On Wed, 19 Feb 2014 18:48:02 -0300, wrote: Hi! Hi! var db = function decorateBody() { document.body.setAttribute("onload","setPosition();"); document.body.setAttribute("onScroll","setPosition();"); } You're using JavaScript that looks like 10 years ago. Use event listeners for

Re: Executing JS function from component ONCE

2014-02-19 Thread Geoff Callender
ut nothing helped. > Only working solution is to use addScript() as Dmitry suggested, I'm not > very happy with storing flag in request solution, but it is currently best > solution I have. > > Best regards > Ladislav > > > > -- Původní zpráva --

Re: Executing JS function from component ONCE

2014-02-19 Thread lacko
lution is to use addScript() as Dmitry suggested, I'm not very happy with storing flag in request solution, but it is currently best solution I have. Best regards Ladislav -- Původní zpráva -- Od: Thiago H de Paula Figueiredo Komu: Tapestry users Datum: 19. 2. 2014 19:17

Re: Executing JS function from component ONCE

2014-02-19 Thread Thiago H de Paula Figueiredo
On Wed, 19 Feb 2014 14:54:07 -0300, Dmitry Gusev wrote: Another option could be to store some attribute in the request scope and only call javaScriptSupport.addScript once on the server side. JavaScriptSupport.addSCript() is deprecated in T5.4. In addition, I've just noticed, he's doing a

Re: Executing JS function from component ONCE

2014-02-19 Thread Dmitry Gusev
Another option could be to store some attribute in the request scope and only call javaScriptSupport.addScript once on the server side. On Wed, Feb 19, 2014 at 8:19 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 19 Feb 2014 12:16:33 -0300, wrote: > > javaScriptSupport.

Re: Executing JS function from component ONCE

2014-02-19 Thread Thiago H de Paula Figueiredo
On Wed, 19 Feb 2014 12:16:33 -0300, wrote: javaScriptSupport.addScript("decorateBody();"); in @AfterRender method. It works, but when I use more of my components in one page, "decorateBody();" call is called x times, where x is number of components on the page. That's very easy and Tapest

Re: Executing JS function from component ONCE

2014-02-19 Thread Thiago H de Paula Figueiredo
On Wed, 19 Feb 2014 12:16:33 -0300, wrote: Hi everyone! Hi! Question 1: Is it possible to specify something "execute only once in page" on component level? (call from page containing the components is not solution for me, I want to have my component "independent") No. Question 2: Is

Executing JS function from component ONCE

2014-02-19 Thread lacko
Hi everyone! I've implemented component, which needs JavaScript function for proper positioning and I need to set this function as 's "onload" and "onScroll" events. So, I have .js file with my possitioning function and also decorateBody() function which I need to call after page is created.