You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2010/06/03 14:48:38 UTC
Opening a new modal window when OK is clicked on currently open modal window
Is it possible to replace the currently open Modal window with a
different modal window from within the OK click handler of the currently
open modal window?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Opening a new modal window when OK is clicked on currently open
modal window
Posted by Istvan Jozsa <jo...@gmail.com>.
Yes, by opening the second window *when* the first is closed.
Try something like this:
abstract class Modal1 extends ModalWindow {
public Modal1(id) {
// ...
setWindowClosedCallback(new ModalWindow.CloseButtonCallback() {
@Override
public void onClose(AjaxRequestTarget target) {
Modal1.this.onClose(target);
}
});
}
protected abstract void onClose(AjaxRequestTarget target);
public Modal1 showMe(target) {
// ...
super.show();
return this;
}
}
// somewhere in the page:
ModalWindow modal1, modal2;
// ...
add(modal1 = new Modal1("w1") {
@Override
void onClose(AjaxRequestTarget target) {
modal2.show(target);
}
});
add(modal2 = new Modal2("w2"));
// ...
modal1.showMe(target);
The more flexible solution is by
setting the close callback *when* the window is shown:
modal1.showMe(target).setWindowClosedCallback(new
ModalWindow.CloseButtonCallback() {
@Override
public void onClose(AjaxRequestTarget target) {
modal2.show(target);
}
});
On Thu, Jun 3, 2010 at 3:48 PM, Chris Colman
<ch...@stepaheadsoftware.com>wrote:
> Is it possible to replace the currently open Modal window with a
> different modal window from within the OK click handler of the currently
> open modal window?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>