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="[EMAIL PROTECTED]"> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]