You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Asenov <mA...@velti.com> on 2010/02/12 09:19:37 UTC

modal in a modal problem

Hello, everyone!

I experience a problem when triggering a modal window from another modal window. When a removal icon is clicked in the first modal, there's a confirmation dialog, that pops up. Although I've set everything up, the windowClosedCallback gets activated only when I confirm removal twice. I have no idea why it happens this way. The confirmation dialog works fine for all RepeaterHoldingPage-s I have, excluding the one I have placed in another modal. Here's the code of the conf dialog:

       public ConfirmationDialog(String question, final ModalWindow parent, final RepeaterHoldingPage page, final Object entry) {

             System.out.println("confirmation dialog called");

             questionLabel = new Label("question", question);
             yesButton = new AjaxButton("yes_button", new Model<String>(getString("yes"))) {

                    private static final long serialVersionUID = 1l;

                    @Override
                    protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                           System.out.println("yes button clicked");
                           parent.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

                                  private static final long serialVersionUID = 1L;

                                  @Override
                                  public void onClose(AjaxRequestTarget target) {
                                        page.removeItem(entry, target);
                                        System.out.println("removal supposed to be called");
                                  }
                           });

                           parent.close(target);
                    }
             };

What happens is that I trigger the conf dialog, press the 'yes' button and in the console the following gets printed:
confirmation dialog called;