I have a label which is used mutiple times in my page. It works fine, until I try to update the label per ajax. Result: only the first label gets updated. Is it a known issue? I'm not sure, since I can't open the JIRA page: https://issues.apache.org/jira/browse/wicket (Get throbber all time). I'm using wicket version 7.3.0
To reproduce this issue:
1. Add an label on your page (java part):
private final Label label;
..
label = new Label("yourLabel", "Your Text");
label.setOutputMarkupId(true);
add(label);
...
1. Add your label multiple time (for e.g. 4 times) in your page (html part):
...
<span wicket:id="yourLabel"/>
<span wicket:id="yourLabel"/>
<span wicket:id="yourLabel"/>
<span wicket:id="yourLabel"/>
...
2. Add event handler for e.g. the ajax event is UpdateEvent in your page (java part)
...
@Override
public void onEvent(IEventevent) {
if (event.getPayload() instanceof UpdateEvent) {
//update your label
label.setDefaultModelObject("new Text");
target.add(label);
}
}
=> only the first label gets updated. I have a workaround for this by adding 4 different instances of label with the same text content.