You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Thiago H. de Paula Figueiredo" <th...@gmail.com> on 2009/06/18 16:50:27 UTC
@AfterRender in AJAX requests
Hi!
I'm trying to execute some Javascript code to hook up some events to
some TextFields in a page. Thus, I need their clientIds. When in an
AJAX request, the TextFields are rendered again with other clientIds,
so I need to generate the Javascript event hooking again.I created a
method annotated with @AfterRender and use RenderSupport to generate
the event hooking code. In a full page request, my method is called
and everything is fine. But, in an AJAX request, my @AfterRender
method is not invoked and my @BeginRender is invoked (it returns
void). I cannot use @BeginRender in this case because the fields
client ids are only defined during rendering.
What am I missing?
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: @AfterRender in AJAX requests
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Jun 19, 2009 at 12:06 AM, DH<ni...@gmail.com> wrote:
> Hi, Thiago
Hi!
> Not sure about how special your case is, but I can confirm that @AfterRender is invoked in my ajax request.
> Maybe share more about the code and let us help you kind man.
I know that I'm missing something. I just wasn't smart enough to
figure out by myself yet. :)
Relevant parts of my page class:
@InjectComponent
private TextField textField;
@BeginRender
public void initializeSearchType() {
...
}
@AfterRender
public void inicializarJavascript() {
renderSupport.addScript("initializeSearchField();");
renderSupport.addScript("Event.observe('%s', 'click',
handleSearchEvent);", textField.getClientId());
}
Template:
<div t:type="Zone" t:id="zone">
<form autocomplete="off" t:type="Form" t:zone="zone">
......
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: @AfterRender in AJAX requests
Posted by DH <ni...@gmail.com>.
Hi, Thiago
Not sure about how special your case is, but I can confirm that @AfterRender is invoked in my ajax request.
Maybe share more about the code and let us help you kind man.
DH
http://www.gaonline.com.cn
----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <th...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, June 18, 2009 10:50 PM
Subject: @AfterRender in AJAX requests
> Hi!
>
> I'm trying to execute some Javascript code to hook up some events to
> some TextFields in a page. Thus, I need their clientIds. When in an
> AJAX request, the TextFields are rendered again with other clientIds,
> so I need to generate the Javascript event hooking again.I created a
> method annotated with @AfterRender and use RenderSupport to generate
> the event hooking code. In a full page request, my method is called
> and everything is fine. But, in an AJAX request, my @AfterRender
> method is not invoked and my @BeginRender is invoked (it returns
> void). I cannot use @BeginRender in this case because the fields
> client ids are only defined during rendering.
>
> What am I missing?
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: @AfterRender in AJAX requests
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
I've just figured out what I was missing . . .
I put the @AfterRender and @BeforeRender methods in my page class.
When an AJAX request was made, they were not invoked, because a zone
was being rendered, not the page itself. I moved everything to a
component, used inside a zone, and now everything works. (little
victory dance here. :))
Anyway, thanks DH. ;)
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org