I found the solution. I will post it for everyone that is interested. 

I created a this class:

public class AjaxCancelEventBubbleCallDecorator extends
AjaxPostprocessingCallDecorator
{
        private static final long serialVersionUID = 1L;

        public AjaxCancelEventBubbleCallDecorator()
        {
                this((IAjaxCallDecorator)null);
        }
        
        public AjaxCancelEventBubbleCallDecorator(IAjaxCallDecorator delegate)
        {
                super(delegate);
        }

        public CharSequence postDecorateScript(CharSequence script)
        {
                return "e = window.event; if(e.stopPropagation)
{e.stopPropagation();}else{e.cancelBubble = true;}" + script;
        }
}

Then on the AjaxLink override this method:

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
   {
          return new AjaxCancelEventBubbleCallDecorator();
   }

Thanks,

Josh


jchappelle wrote:
> 
> I have an AjaxLink inside a div. There is an onclick event handler added
> at the document level in the dom. If I am clicking the div that contains
> my AjaxLink the event will fire. However, I don't want it to fire if I
> click the link. 
> 
> It seems that there is a way to do this in javascript. I think it is
> called cancelling event bubbling. Can someone help me do this in wicket?
> 
> Thanks,
> 
> Josh
> 

-- 
View this message in context: 
http://www.nabble.com/stopping-event-bubbling-from-link-to-enclosing-div-tp20025613p20025840.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to