You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark Reynolds <ma...@gmail.com> on 2006/11/25 06:13:29 UTC
Updated component loses it's @EventListener
Here is my latest issue:
I am trying to use @EventListener to handle cascading dependencies in
PropertySelections. Imagine three PropertySelections in a form, representing
countries, regions, and cities respectively. When the user selects a
country, the regions list is populated with appropriate values. When the
user selects a region, the cities list is populated with appropriate values.
The problem I am having is that when the regions PropertySelection is
re-rendered using @EventListener and
cycle.getResponseBuilder().updateComponent("regions"),
the newly written "regions" element is not connected to its listener. I
looks as if the listeners are attached to the elements when the page is
first rendered and if an individual element is re-rendered, it is not hooked
up to any listener. If I call
cycle.getResponseBuilder().updateComponent("body")
then the listeners get hooked up again, but that sort of defeats the whole
purpose, plus has the side effect of putting the focus back on the first
field.
Has anyone gotten something like this working?
-- Mark R
Re: Re: Updated component loses it's @EventListener
Posted by Sam Gendler <sg...@ideasculptor.com>.
Good to know. I do that a lot. Thanks.
--sam
On 11/27/06, Mark Reynolds <ma...@gmail.com> wrote:
> Thanks, Sam. This was helpful. It turns out that if I directly call
> .updateComponent on the PropertySelection, then it works. If I wrap the
> PropertySelection in a <span jwcid="myspan@Any"> and call .updateComponent
> on the span, then the updated component in the span loses its listener. I
> think this may be a bug so I have submitted it to JIRA for Jesse to look at.
>
>
> On 11/25/06, Sam Gendler <sg...@ideasculptor.com> wrote:
> >
> > it works fine for me in a fairly old (mid october) snapshot of 4.1.
> > I've got 3 selects that cascade - genres, artists, and disks (plus a
> > table to list tracks) - so the setup should be pretty much identical.
> > My listeners look like this:
> >
> > @EventListener(elements="genres",
> > events="onchange",
> > submitForm="selectForm",
> > async=true)
> > public void cascadeGenres() {
> > debugCascade(); // print selected values
> > initModels(); // load models with correct data
> > getRequestCycle().getResponseBuilder().updateComponent("artists");
> > getRequestCycle().getResponseBuilder().updateComponent("disks");
> >
> > getRequestCycle().getResponseBuilder().updateComponent("trackTable");
> > setBuildTableModel(true);
> > }
> >
> > @EventListener(elements="artists",
> > events="onchange",
> > submitForm="selectForm",
> > async=true)
> > public void cascadeArtists() {
> > debugCascade();
> > initModels();
> > getRequestCycle().getResponseBuilder().updateComponent("disks");
> >
> > getRequestCycle().getResponseBuilder().updateComponent("trackTable");
> > setBuildTableModel(true);
> > }
> >
> > @EventListener(elements="disks",
> > events="onchange",
> > submitForm="selectForm",
> > async=true)
> > public void cascadeDisks() {
> > debugCascade();
> > initModels();
> > getRequestCycle().getResponseBuilder().updateComponent("trackTable");
> >
> > setBuildTableModel(true);
> > }
> >
> > --sam
> >
> > On 11/24/06, Mark Reynolds <ma...@gmail.com> wrote:
> > > Here is my latest issue:
> > >
> > > I am trying to use @EventListener to handle cascading dependencies in
> > > PropertySelections. Imagine three PropertySelections in a form,
> > representing
> > > countries, regions, and cities respectively. When the user selects a
> > > country, the regions list is populated with appropriate values. When the
> > > user selects a region, the cities list is populated with appropriate
> > values.
> > >
> > > The problem I am having is that when the regions PropertySelection is
> > > re-rendered using @EventListener and
> > > cycle.getResponseBuilder().updateComponent("regions"),
> > > the newly written "regions" element is not connected to its listener. I
> > > looks as if the listeners are attached to the elements when the page is
> > > first rendered and if an individual element is re-rendered, it is not
> > hooked
> > > up to any listener. If I call
> > > cycle.getResponseBuilder().updateComponent("body")
> > > then the listeners get hooked up again, but that sort of defeats the
> > whole
> > > purpose, plus has the side effect of putting the focus back on the first
> > > field.
> > >
> > > Has anyone gotten something like this working?
> > >
> > > -- Mark R
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
Re: Updated component loses it's @EventListener
Posted by Mark Reynolds <ma...@gmail.com>.
Thanks, Sam. This was helpful. It turns out that if I directly call
.updateComponent on the PropertySelection, then it works. If I wrap the
PropertySelection in a <span jwcid="myspan@Any"> and call .updateComponent
on the span, then the updated component in the span loses its listener. I
think this may be a bug so I have submitted it to JIRA for Jesse to look at.
On 11/25/06, Sam Gendler <sg...@ideasculptor.com> wrote:
>
> it works fine for me in a fairly old (mid october) snapshot of 4.1.
> I've got 3 selects that cascade - genres, artists, and disks (plus a
> table to list tracks) - so the setup should be pretty much identical.
> My listeners look like this:
>
> @EventListener(elements="genres",
> events="onchange",
> submitForm="selectForm",
> async=true)
> public void cascadeGenres() {
> debugCascade(); // print selected values
> initModels(); // load models with correct data
> getRequestCycle().getResponseBuilder().updateComponent("artists");
> getRequestCycle().getResponseBuilder().updateComponent("disks");
>
> getRequestCycle().getResponseBuilder().updateComponent("trackTable");
> setBuildTableModel(true);
> }
>
> @EventListener(elements="artists",
> events="onchange",
> submitForm="selectForm",
> async=true)
> public void cascadeArtists() {
> debugCascade();
> initModels();
> getRequestCycle().getResponseBuilder().updateComponent("disks");
>
> getRequestCycle().getResponseBuilder().updateComponent("trackTable");
> setBuildTableModel(true);
> }
>
> @EventListener(elements="disks",
> events="onchange",
> submitForm="selectForm",
> async=true)
> public void cascadeDisks() {
> debugCascade();
> initModels();
> getRequestCycle().getResponseBuilder().updateComponent("trackTable");
>
> setBuildTableModel(true);
> }
>
> --sam
>
> On 11/24/06, Mark Reynolds <ma...@gmail.com> wrote:
> > Here is my latest issue:
> >
> > I am trying to use @EventListener to handle cascading dependencies in
> > PropertySelections. Imagine three PropertySelections in a form,
> representing
> > countries, regions, and cities respectively. When the user selects a
> > country, the regions list is populated with appropriate values. When the
> > user selects a region, the cities list is populated with appropriate
> values.
> >
> > The problem I am having is that when the regions PropertySelection is
> > re-rendered using @EventListener and
> > cycle.getResponseBuilder().updateComponent("regions"),
> > the newly written "regions" element is not connected to its listener. I
> > looks as if the listeners are attached to the elements when the page is
> > first rendered and if an individual element is re-rendered, it is not
> hooked
> > up to any listener. If I call
> > cycle.getResponseBuilder().updateComponent("body")
> > then the listeners get hooked up again, but that sort of defeats the
> whole
> > purpose, plus has the side effect of putting the focus back on the first
> > field.
> >
> > Has anyone gotten something like this working?
> >
> > -- Mark R
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Updated component loses it's @EventListener
Posted by Sam Gendler <sg...@ideasculptor.com>.
it works fine for me in a fairly old (mid october) snapshot of 4.1.
I've got 3 selects that cascade - genres, artists, and disks (plus a
table to list tracks) - so the setup should be pretty much identical.
My listeners look like this:
@EventListener(elements="genres",
events="onchange",
submitForm="selectForm",
async=true)
public void cascadeGenres() {
debugCascade(); // print selected values
initModels(); // load models with correct data
getRequestCycle().getResponseBuilder().updateComponent("artists");
getRequestCycle().getResponseBuilder().updateComponent("disks");
getRequestCycle().getResponseBuilder().updateComponent("trackTable");
setBuildTableModel(true);
}
@EventListener(elements="artists",
events="onchange",
submitForm="selectForm",
async=true)
public void cascadeArtists() {
debugCascade();
initModels();
getRequestCycle().getResponseBuilder().updateComponent("disks");
getRequestCycle().getResponseBuilder().updateComponent("trackTable");
setBuildTableModel(true);
}
@EventListener(elements="disks",
events="onchange",
submitForm="selectForm",
async=true)
public void cascadeDisks() {
debugCascade();
initModels();
getRequestCycle().getResponseBuilder().updateComponent("trackTable");
setBuildTableModel(true);
}
--sam
On 11/24/06, Mark Reynolds <ma...@gmail.com> wrote:
> Here is my latest issue:
>
> I am trying to use @EventListener to handle cascading dependencies in
> PropertySelections. Imagine three PropertySelections in a form, representing
> countries, regions, and cities respectively. When the user selects a
> country, the regions list is populated with appropriate values. When the
> user selects a region, the cities list is populated with appropriate values.
>
> The problem I am having is that when the regions PropertySelection is
> re-rendered using @EventListener and
> cycle.getResponseBuilder().updateComponent("regions"),
> the newly written "regions" element is not connected to its listener. I
> looks as if the listeners are attached to the elements when the page is
> first rendered and if an individual element is re-rendered, it is not hooked
> up to any listener. If I call
> cycle.getResponseBuilder().updateComponent("body")
> then the listeners get hooked up again, but that sort of defeats the whole
> purpose, plus has the side effect of putting the focus back on the first
> field.
>
> Has anyone gotten something like this working?
>
> -- Mark R
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org