You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maurice Marrink <ma...@gmail.com> on 2008/05/01 17:24:03 UTC

Re: Unable to close modalwindow

It looks like you are creating a new modalwindow for each item. Try
creating 1 modalwindow outside the dataview and update the content
(just as you are doing now) in the onclick of your edit link.
Also you should not call modalwindow.close from inside your
windowClosedCallBack, not sure what effect it will have but it is
completely pointless as the window has already been closed. in this
case by the code in the onsubmit.

Maurice

On Wed, Apr 30, 2008 at 3:02 PM, tsuresh <su...@hotmail.com> wrote:
>
>  Hello All,
>  I am unable to close modalwindow which contains a panel with the form.My
>  code snippet in page is as
>
>  follows:
>  .........
>
>   final DataView dataView = new DataView("rows", new
>  ListDataProvider(folderList)) {
>
>                 public void populateItem(final Item item) {
>                     FolderWrapper fw = (FolderWrapper)
>  item.getModelObject();
>                     item.add(new CheckBox("checkbox", new PropertyModel(fw,
>  "selected")));
>                     item.add(new Label("subKeyword",
>  fw.getKeyword().getSubKeyword()));
>                     item.add(new Label("description",
>  fw.getKeyword().getDescription()));
>                     item.add(new Label("email",
>  fw.getKeyword().getEmail()));
>
>                     AjaxLink editLink = new AjaxLink("edit") {
>
>                         public void onClick(AjaxRequestTarget target) {
>                             FolderWrapper selectedKeyword =
>  (FolderWrapper)getParent().getModelObject();
>                             modalS.setContent(new
>  FolderEditPanel(modalS.getContentId(),
>                                       selectedKeyword.getKeyword(), modalS));
>                             modalS.setTitle("Details:");
>                             modalS.show(target);
>                         }
>                     };
>
>                     modalS = new ModalWindow("modalS");
>                     modalS.setInitialWidth(450);
>                     modalS.setInitialHeight(200);
>                     modalS.setWindowClosedCallback(new
>  ModalWindow.WindowClosedCallback() {
>
>                         public void onClose(AjaxRequestTarget target) {
>                             modalS.close(target);
>                         }
>                     });
>                     editLink.add(modalS);
>                     item.add(editLink);
>
>  .............
>
>
>  And the Panel which contains edit form :
>
>   public FolderEditPanel(String id, Keyword keyword, final ModalWindow
>  window) {
>         super(id);
>         selectedKeyword = keyword;
>         Form folderEditForm = new FolderEditForm("form");
>         folderEditForm.setOutputMarkupId(true);
>         add(folderEditForm);
>         folderEditForm.add(new AjaxButton("ok") {
>
>             @Override
>             protected void onSubmit(AjaxRequestTarget target, Form form) {
>                 try {
>                     selectedKeyword.edit();
>                 } catch (SQLException e) {
>                     String err = e.getMessage();
>                 }
>                 window.close(target);
>             }
>         });
>     }
>
>  But similar codes works fine when I don't use wrapper(i.e FolderWrapper to
>  add checkbox to select
>
>  items).
>
>  Thanks,
>  tsuresh
>
>  --
>  View this message in context: http://www.nabble.com/Unable-to-close-modalwindow-tp16981993p16981993.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org