Thank you so much Martin. Adding the script seems to be the soultion. At least
it works now as i expect it :-).
I would say yes to your question. I don't know if it bubbles up. But in the
requestcycle the requestedUri is always the event listener one.
I've added a test, but that is green :-(
<code>
@Test
public void shouldPrioritizeBookmarkableLinkClickOverClickableDiv() {
tester.startPage(Page.class);
tester.clickLink("outer:inner");
tester.assertRenderedPage(OtherPage.class);
}
</code>
Thanks
Per
> Gesendet: Mittwoch, 24. April 2013 um 09:19 Uhr
> Von: "Martin Grigorov" <[email protected]>
> An: "[email protected]" <[email protected]>
> Betreff: Re: Can i control event execution order?
>
> Hi,
>
> Are you saying that the event of clicking the bookmarkable link (the <a>)
> bubbles to the <div> ?
> I think it should not happen. Clicking the link changes the document
> location... But I may be wrong.
>
> A simple solution is to add onclick="Wicket.Event.stop(event); return
> true;" to the <a> element.
> This calls event.stopPropagation().
>
>
> On Wed, Apr 24, 2013 at 10:03 AM, Per Newgro <[email protected]> wrote:
>
> > Hi,
> >
> > i would like to add a bookmarkable page link to a clickable div.
> > But the event behavior of the div is always executed. Is there a
> > way to prioritize the event coming from the link?
> >
> > Thanks
> > Per
> >
> > <code>
> > Page.java
> > public class Page extends WebPage {
> > public Page(final PageParameters parameters) {
> > super(parameters);
> >
> > final Label marker;
> > add(marker = new Label("marker", new Model<String>()));
> > marker.setOutputMarkupId(true);
> >
> > WebMarkupContainer outer;
> > add(outer = (WebMarkupContainer) new
> > WebMarkupContainer("outer").add(new AjaxEventBehavior("onclick") {
> >
> > @Override
> > protected void onEvent(AjaxRequestTarget target) {
> > marker.setDefaultModelObject("outer at " +
> > System.currentTimeMillis());
> > target.add(marker);
> > }
> > }));
> >
> > BookmarkablePageLink<Void> inner;
> > outer.add(inner = new BookmarkablePageLink<Void>("inner",
> > OtherPage.class));
> > }
> > }
> >
> > Page.html
> > <div>
> > <span wicket:id="marker">Present the event</span>
> > <div wicket:id="outer">
> > <a wicket:id="inner">Click</a>
> > </div>
> > </div>
> > </code>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]