Why not put everything in the AjaxFormComponentUpdatingBehavior?

As in:

       dropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange")
{

           @Override
           protected void onUpdate(AjaxRequestTarget target) {
               LOG.debug("New updated value: " +
this.getComponent().getDefaultModelObjectAsString());
               target.addComponent(this.getComponent());
*
//This code was in the AjaxEventBehavior before
 LOG.debug("DroDownChoice's parent " +
IntegrityLevelDropDownPanel.*
*this.getParent().getParent().**getParent());

target.addComponent(* *IntegrityLevelDropDownPanel.**
this.getParent().getParent().**getParent());*

           }

       });


On Fri, Jul 22, 2011 at 6:32 AM, Rodrigo Heffner
<rodrigo.heff...@gmail.com>wrote:

> Hi guys,
>
> I'm very new to Wicket, and I came across this:
>
> What I want to do:
> - I have a DropDownChoice component and I'd like to update it's model
> when it changes through AJAX. Also, I want to refresh (repaint,
> reload) this dropdown's parent when a value is changed, also though
> AJAX.
>
> My approach:
> - Adding an AjaxEventBehavior("onchange") AND an
> AjaxFormComponentUpdatingBehavior("onchange"). Here's the code:
>
>        dropDownChoice.add(new AjaxEventBehavior("onchange") {
>
>            protected void onEvent(AjaxRequestTarget target) {
>                LOG.debug("DroDownChoice's parent " +
> IntegrityLevelDropDownPanel.this.getParent().getParent().getParent());
>
>
> target.addComponent(IntegrityLevelDropDownPanel.this.getParent().getParent().getParent());
>            }
>        });
>
>        dropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange")
> {
>
>            @Override
>            protected void onUpdate(AjaxRequestTarget target) {
>                LOG.debug("New updated value: " +
> this.getComponent().getDefaultModelObjectAsString());
>                target.addComponent(this.getComponent());
>            }
>
>        });
>
> The Problem:
> - Unfortunately both "onchange" events don't work together. Depending
> on the order of my code, the AjaxFormComponentUpdatingBehavior or the
> AjaxEventBehavior are executed, but not both.
>
> I've changed one of them to happen "onblur" and then they're both
> executed, but this is not a solution to my issue.
>
> Does anybody have any tips for this? I've been searching for a while
> but couldn't find anything that solves this.
>
>
> Thank you in advance,
>
> --
> Rodrigo H M Bezerra
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to