In order to setResponse to one field or another I have to have some flag that
determines which one.
Even using a model, and setting it from whithin the onClick of the AjaxLink,
the model within the closed window callback remains null. It is as if
whatever is set within the closed window callback cannot be modified at all.
TypeModel remains unchanged in the setWindowClsoedCallBack despite the lines
in the onClick:
type = MyType.FIRST;
typeModel.setObject(type);
window.setDefaultModel(typeModel);
So:
private MyType type = MyType.FIRST;
IModel<MyType> typeModel = new Model<MyType> (type);
public MyModalWindow(final PageReference modalWindowPage,
final ModalWindow window,
final PageParameters parameters) {
window.setDefaultModel(typeModel);
window.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = 1L;
public void onClose(AjaxRequestTarget target) {
modalWindowPage.getPage()
.setResponsePage(typeModel.getObject().equals(MyType.SECOND) ? new
SecongPage(parameters)
: new FirstPage(parameters));
}
});
add(new AjaxLink<Void>("firstPage") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
type = MyType.FIRST;
typeModel.setObject(type);
window.setDefaultModel(typeModel);
window.close(target);
}
});
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/close-a-modal-window-and-setResponsePage-tp2074789p4657644.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]