Here's the working code in my form class:
@Override
protected void onModelChanged() {
super.onModelChanged();
if (this.formFieldList == null) return;
this.formFieldList.visitChildren(new
FieldVisitor<Component>((IModel<T>)this.getDefaultModel()));
}
Code in visitor:
public class FieldVisitor<T extends Component> implements IVisitor<T> {
private static final Logger LOG =
LoggerFactory.getLogger(FieldVisitor.class);
private IModel<?> model;
public FieldVisitor(final IModel<?> theModel) {
this.model = theModel;
}
@Override
public Object component(final Component theComponent) {
((Component)theComponent.getDefaultModelObject()).setDefaultModelObject(this.model.getObject());
((Component)theComponent.getDefaultModelObject()).modelChanged(); //I
GUESS THIS ONE WAS MISSING
return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
}
Regards
Armando
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Form-with-dynamic-fields-model-not-updating-tp2954185p2955673.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]