I know that I can subscribe to events using Wicket 6+ which is what I do in my application. Now I am trying to cancel an Ajax event on a particular occurrence of some condition like that:
Wicket.Event.subscribe('/ajax/call/before', function (jqEvent,
attributes,
jqXHR,
errorThrown,
textStatus) {
if(someCondition) {
// Abort event, but how?
}
});
I am looking for a way to abort the event, but the normal jQuery event handlers
jqEvent.stopImmediatePropagation();
jqEvent.preventDefault();
or even
attributes.event.stopImmediatePropagation();
attributes.event.preventDefault();
but they do not seem to work. If the method returns a value, this does not seem to have an effect either. The easiest I found so far is simply throwing an exception but this solution is far from clean.