You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gabriel Bucher <ga...@gmail.com> on 2011/04/12 11:29:43 UTC

[1.5-RC3] AjaxLink: order of added behaviors in relation to AjaxEventBehavior

in wicket 1.4 I used an Behavior called OnClickConfirmBehavior to add a 
javascript confirm dialog:

AjaxLink link = ...
link.add( new OnClickConfirmBehavior(...) );


if I do the same in wicket 1.5-rc3, the javascript confirm dialog never 
appears.


this has to do with the order, who the behaviors are added to the link 
component:
in wicket 1.4: the AjaxEventBehavior is added in the constructor.
order of behaviors:
1) AjaxEventBehavior
2) OnClickConfirmBehavior

in wicket 1.5-rc3: the AjaxEventBehavior is added in the onInitialize 
methods... the above example results in the following order of behaviors:
1) OnClickConfirmBehavior
2) AjaxEventBehavior


is this a deliberate behavior for the AjaxLink in wicket 1.5-rc3? or 
should the AjaxEventBehavior be added in the constructor?


cheers gab





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [1.5-RC3] AjaxLink: order of added behaviors in relation to AjaxEventBehavior

Posted by Gabriel Bucher <ga...@razor.ch>.
Hi Martin,

thanks for the hint... this way works for me too.

cheers gab


On 12/04/11 17:42, Martin Grigorov wrote:
> I moved the registration in #onInitialize() so that now it is possible to
> customize the behavior if needed.
> See 1.5-RC3 changelog for more details.
>
> For your use case it is better to use AjaxLink#getAjaxCallDecorator()
> instead.
> override decorateScript(Component comp, String script) {
>    return "!confirm('Are you sure?') {" + script + "}";
> }
>
> On Tue, Apr 12, 2011 at 11:29 AM, Gabriel Bucher
> <ga...@gmail.com>wrote:
>
>> in wicket 1.4 I used an Behavior called OnClickConfirmBehavior to add a
>> javascript confirm dialog:
>>
>> AjaxLink link = ...
>> link.add( new OnClickConfirmBehavior(...) );
>>
>>
>> if I do the same in wicket 1.5-rc3, the javascript confirm dialog never
>> appears.
>>
>>
>> this has to do with the order, who the behaviors are added to the link
>> component:
>> in wicket 1.4: the AjaxEventBehavior is added in the constructor.
>> order of behaviors:
>> 1) AjaxEventBehavior
>> 2) OnClickConfirmBehavior
>>
>> in wicket 1.5-rc3: the AjaxEventBehavior is added in the onInitialize
>> methods... the above example results in the following order of behaviors:
>> 1) OnClickConfirmBehavior
>> 2) AjaxEventBehavior
>>
>>
>> is this a deliberate behavior for the AjaxLink in wicket 1.5-rc3? or should
>> the AjaxEventBehavior be added in the constructor?
>>
>>
>> cheers gab
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [1.5-RC3] AjaxLink: order of added behaviors in relation to AjaxEventBehavior

Posted by Igor Vaynberg <ig...@gmail.com>.
we should probably make the ajax behavior append to the attribute
instead of overriding it...

-igor

On Tue, Apr 12, 2011 at 2:42 AM, Martin Grigorov <mg...@apache.org> wrote:
> I moved the registration in #onInitialize() so that now it is possible to
> customize the behavior if needed.
> See 1.5-RC3 changelog for more details.
>
> For your use case it is better to use AjaxLink#getAjaxCallDecorator()
> instead.
> override decorateScript(Component comp, String script) {
>  return "!confirm('Are you sure?') {" + script + "}";
> }
>
> On Tue, Apr 12, 2011 at 11:29 AM, Gabriel Bucher
> <ga...@gmail.com>wrote:
>
>> in wicket 1.4 I used an Behavior called OnClickConfirmBehavior to add a
>> javascript confirm dialog:
>>
>> AjaxLink link = ...
>> link.add( new OnClickConfirmBehavior(...) );
>>
>>
>> if I do the same in wicket 1.5-rc3, the javascript confirm dialog never
>> appears.
>>
>>
>> this has to do with the order, who the behaviors are added to the link
>> component:
>> in wicket 1.4: the AjaxEventBehavior is added in the constructor.
>> order of behaviors:
>> 1) AjaxEventBehavior
>> 2) OnClickConfirmBehavior
>>
>> in wicket 1.5-rc3: the AjaxEventBehavior is added in the onInitialize
>> methods... the above example results in the following order of behaviors:
>> 1) OnClickConfirmBehavior
>> 2) AjaxEventBehavior
>>
>>
>> is this a deliberate behavior for the AjaxLink in wicket 1.5-rc3? or should
>> the AjaxEventBehavior be added in the constructor?
>>
>>
>> cheers gab
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: [1.5-RC3] AjaxLink: order of added behaviors in relation to AjaxEventBehavior

Posted by Martin Grigorov <mg...@apache.org>.
I moved the registration in #onInitialize() so that now it is possible to
customize the behavior if needed.
See 1.5-RC3 changelog for more details.

For your use case it is better to use AjaxLink#getAjaxCallDecorator()
instead.
override decorateScript(Component comp, String script) {
  return "!confirm('Are you sure?') {" + script + "}";
}

On Tue, Apr 12, 2011 at 11:29 AM, Gabriel Bucher
<ga...@gmail.com>wrote:

> in wicket 1.4 I used an Behavior called OnClickConfirmBehavior to add a
> javascript confirm dialog:
>
> AjaxLink link = ...
> link.add( new OnClickConfirmBehavior(...) );
>
>
> if I do the same in wicket 1.5-rc3, the javascript confirm dialog never
> appears.
>
>
> this has to do with the order, who the behaviors are added to the link
> component:
> in wicket 1.4: the AjaxEventBehavior is added in the constructor.
> order of behaviors:
> 1) AjaxEventBehavior
> 2) OnClickConfirmBehavior
>
> in wicket 1.5-rc3: the AjaxEventBehavior is added in the onInitialize
> methods... the above example results in the following order of behaviors:
> 1) OnClickConfirmBehavior
> 2) AjaxEventBehavior
>
>
> is this a deliberate behavior for the AjaxLink in wicket 1.5-rc3? or should
> the AjaxEventBehavior be added in the constructor?
>
>
> cheers gab
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>