Here's the code:


first modal:



public class DisplayEventsPage extends WebPage implements RepeaterHoldingPage {



public DisplayEventsPage(final ModalWindow parent) {



         ModalWindow dialog = new ModalWindow("modal");



         AjaxLink<String> entryRemovalLink = new 
AjaxLink<String>("event_removal_link") {



                   private static final long serialVersionUID = 1L;



                   @Override

                   public void onClick(AjaxRequestTarget target) {



                            dialog.setPageCreator(new ModalWindow.PageCreator() 
{



                                      private final static long 
serialVersionUID = 1l;



                                      public Page createPage() {

                                      return new 
ConfirmationDialog(getString("event_deletion"), dialog, DisplayEventsPage.this);

                                                                         }

                            });

                                      dialog.show(target);



}



add(entryRemovalLink);

add(dialog);

}

}



and....



public class ConfirmationDialog extends WebPage {

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

         add(new AjaxButton("yes_button", new Model<String>(getString("yes"))) {



                   private static final long serialVersionUID = 1l;



                   @Override

                   protected void onSubmit(AjaxRequestTarget target, Form<?> 
form) {

                                      parent.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {



                                               @Override

                                               public void 
onClose(AjaxRequestTarget target) {

                                                        page.removeItem(entry, 
target);

                                               }

                                      });



                                      parent.close(target);

                            }

                   };

}

}



Obviously there's something wrong with the code. First of all the 
removeItem(entry, target) never gets called, and also, when I click on close 
button of the top modal (confirmation dialog) the middle one 
(displayeventspage) shows 'page expired' message and everything gets messed up, 
no matter if I've put closebutton callback of the top modal or not.



I would be glad if someone shed more light on this issue, because I can't solve 
it.



Thank you in advance!

BR,

Martin



-----Original Message-----
From: Martin Asenov [mailto:mase...@velti.com]
Sent: Tuesday, January 26, 2010 4:03 PM
To: users@wicket.apache.org; mcgreg...@e-card.bg
Subject: RE: modal window contained and displayed by another modal window



Yes, in this example when it comes to closing the second modal from the 'x' 
button the callback returns false obviously. When it does not, everything gets 
messed up and middle modal gets 'page expired'. How can I close the second 
modal and get back to middle modal with no obstacles like these?



Thanks,

Martin



-----Original Message-----

From: Martin Grigorov [mailto:mcgreg...@e-card.bg]

Sent: Monday, January 25, 2010 12:06 PM

To: users@wicket.apache.org

Subject: Re: modal window contained and displayed by another modal window



On Mon, 2010-01-25 at 11:26 +0200, Martin Asenov wrote:

> Hello guys!

>

> I was trying to trigger a modal window from another modal window, but on top 
> modal window closing seems like the bottom page gets refreshed, or something 
> like this, because when I click on something on the middle frame (first 
> modal) that is active after the closing of the top modal, I get something 
> like 'component not found [modal]' and get redirected to home page.

>

> Is there a way to use modal window in another modal window?

There is: http://www.wicketstuff.org/wicket14/ajax/modal-window



But you should use ModalWindow with a Page, not with Panel.

>

> Thanks!

>

> Regards,

> Martin

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

> For additional commands, e-mail: users-h...@wicket.apache.org

>

>







---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

For additional commands, e-mail: users-h...@wicket.apache.org





---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

For additional commands, e-mail: users-h...@wicket.apache.org


Reply via email to