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<marcel.ho...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




Reply via email to