When writing AJAX-specific code for Wicket, in order to make any updates to a component, it needs to be added to the AjaxTarget. If you’ve got a particularly large form, this can get tedious, so use an IVisitor instead!
1
2
3
4
5
6
7
8
9
10
11
@Override
protected void onSubmit(final AjaxRequestTarget target, Form form) {
form.visitFormComponents(new FormComponent.IVisitor() {
public Object formComponent(IFormVisitorParticipant
formComponent) {
final FormComponent fc = (FormComponent)formComponent;
target.addComponent(fc);
return Component.IVisitor.CONTINUE_TRAVERSAL;
}
});
...
And as always, for each component you access via AJAX, you’ll need to:
1
component.setOutputMarkupId(true);