You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marcel Hoerr <Ma...@gmx.de> on 2011/09/21 15:52:15 UTC

AttributeModifier and AjaxLink in 1.5

hey guys,

i have a problem with an AttributeModifer and an AjaxLink in wicket 1.5. we havea custom AttributeModifier ("onclick") which basicly adds a javascript confirm to the given component (Button or in this case an AjaxLink).

in wicket 1.4 the AttributeModifier is added after the AjaxEventBehavior (and its "onclick") of the AjaxLink, in wicket 1.5 the AttributeModifier comes first and gets overriden by the AjaxEventBehavior of the AjaxLink.

is this a bug or a feature?
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

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


Re: AttributeModifier and AjaxLink in 1.5

Posted by Bas Gooren <ba...@iswd.nl>.
Since you want to decorate the javascript generated by the AjaxLink, why 
not override AjaxLink#getAjaxCallDecorator() and override the generated 
javascript in #decorateScript()?

This is how we do it, albeit internally since we've created an 
AjaxConfirmLink subclass:

@Override
     protected IAjaxCallDecorator getAjaxCallDecorator()
     {
         final String confirmation = Javascript.escapeSingle( 
confirmModel.getObject().toString() );

         return new AjaxCallDecorator()
         {

             @Override
             public CharSequence decorateScript( CharSequence script )
             {
                 return String.format( "if( !confirm('%s') ) return 
false; %s", confirmation, script );
             }

         };
     }

Op 21-9-2011 15:56, schreef Martin Grigorov:
> in 1.5 AjaxLink adds its AjaxEventBehavior in its #onInitialize()
> method. that's why it comes second
> You'll have to override onInitialize and add your behavior there
>
> On Wed, Sep 21, 2011 at 4:52 PM, Marcel Hoerr<Ma...@gmx.de>  wrote:
>> hey guys,
>>
>> i have a problem with an AttributeModifer and an AjaxLink in wicket 1.5. we havea custom AttributeModifier ("onclick") which basicly adds a javascript confirm to the given component (Button or in this case an AjaxLink).
>>
>> in wicket 1.4 the AttributeModifier is added after the AjaxEventBehavior (and its "onclick") of the AjaxLink, in wicket 1.5 the AttributeModifier comes first and gets overriden by the AjaxEventBehavior of the AjaxLink.
>>
>> is this a bug or a feature?
>> --
>> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
>> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>

Re: AttributeModifier and AjaxLink in 1.5

Posted by Marcel Hoerr <Ma...@gmx.de>.
works perfectly, thanks a lot.

-------- Original-Nachricht --------
> Datum: Wed, 21 Sep 2011 16:56:54 +0300
> Von: Martin Grigorov <mg...@apache.org>
> An: users@wicket.apache.org
> Betreff: Re: AttributeModifier and AjaxLink in 1.5

> in 1.5 AjaxLink adds its AjaxEventBehavior in its #onInitialize()
> method. that's why it comes second
> You'll have to override onInitialize and add your behavior there
> 
> On Wed, Sep 21, 2011 at 4:52 PM, Marcel Hoerr <Ma...@gmx.de> wrote:
> > hey guys,
> >
> > i have a problem with an AttributeModifer and an AjaxLink in wicket 1.5.
> we havea custom AttributeModifier ("onclick") which basicly adds a
> javascript confirm to the given component (Button or in this case an AjaxLink).
> >
> > in wicket 1.4 the AttributeModifier is added after the AjaxEventBehavior
> (and its "onclick") of the AjaxLink, in wicket 1.5 the AttributeModifier
> comes first and gets overriden by the AjaxEventBehavior of the AjaxLink.
> >
> > is this a bug or a feature?
> > --
> > Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> > belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> >
> > ---------------------------------------------------------------------
> > 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone

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


Re: AttributeModifier and AjaxLink in 1.5

Posted by Martin Grigorov <mg...@apache.org>.
in 1.5 AjaxLink adds its AjaxEventBehavior in its #onInitialize()
method. that's why it comes second
You'll have to override onInitialize and add your behavior there

On Wed, Sep 21, 2011 at 4:52 PM, Marcel Hoerr <Ma...@gmx.de> wrote:
> hey guys,
>
> i have a problem with an AttributeModifer and an AjaxLink in wicket 1.5. we havea custom AttributeModifier ("onclick") which basicly adds a javascript confirm to the given component (Button or in this case an AjaxLink).
>
> in wicket 1.4 the AttributeModifier is added after the AjaxEventBehavior (and its "onclick") of the AjaxLink, in wicket 1.5 the AttributeModifier comes first and gets overriden by the AjaxEventBehavior of the AjaxLink.
>
> is this a bug or a feature?
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>
> ---------------------------------------------------------------------
> 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

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