I figured out a solution that works for me, so here it is:
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String script = tag.getAttribute("onclick");
String stopBubble = "e = window.event;
if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble = true;}";
tag.put("onclick", stopBubble + script);
}
Jered Myers writes:
I need to be able to nest links and have the link clicked on trigger, but
not its parent. I am not sure how to do this with a regular Link. Right
now, I believe that I have a problem with event bubbling. The parent link
it firing when I click on the child. Any help is appreciated.
Example:
An example would be a calendar day where the entire day is a link and the
day contains text that is a different link. Clicking a day will open a
panel that for inserting an event and clicking the text will open a
different panel for editing the event.
<div wicket:id="parent">
<div>
Click here to click paerent and insert
</div>
<table>
<tr>
<td>
<a href="#" wicket:id="child">to edit</a>
</td>
</tr>
</table>
</div>
final Link parent = new Link("parent"){
protected void onClick() { open insert panel };
}
add(parent);
final Link child= new Link("child"){
protected void onClick() { open edit panel };
}
parent.add(child);
Jered Myers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
Jered Myers
Programmer
Maplewood Software
(509)252-3550x109
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org