can you try adding a getter and setter for your Notification obj in
TableViewPage

and at

public void onClick(AjaxRequestTarget target)
{
                Notification obj =
(Notification)getParent().getModelObject();
                 call setter method here
                templateModal.show(target);

}

and call the getter at your modal window, i don't if it will solve your
problem, this is a guess, try it !!


Regards
Dipu




On 7/13/07, angela <[EMAIL PROTECTED]> wrote:


hi all,

any clue on this? anyone can give me some pointers/ guidance/tutorial for
this? I've tried on the wicket-examples to show modal dialog with a page,
it's successfully get the result back to my page. However, i'm having
problem with getting value from dataview to modal window...
Appreciate for anyone help! thanks.

Regards,
Angela

Hi all,

I have a TableViewPage, which has a modal window and the Ajax Link.

The modal window is used to edit item from DataView.
How do i pass value of the selected item from DataView to the modal
window?

Anyone can help me?
Thanks for spending time to read my codes here. :)
I'm using wicket version 1.2.4

Below is my partial codes:

public class TableViewPage extends CommonPage{

public TableViewPage(){

        final ModalWindow templateModal;
        add(templateModal = new ModalWindow("templateModal"));

        templateModal.setPageMapName("templateModal");
        templateModal.setCookieName("templateModal");
        templateModal.setResizable(false);
        templateModal.setTitle("Edit Template");
        templateModal.setOutputMarkupId(true);


        templateModal.setPageCreator(new ModalWindow.PageCreator()
        {
                public Page createPage()
                {
                        return new TemplateModalPage(TableViewPage.this,
templateModal);
                }
        });


        dataView = new DataView("table", dataProvider)
                {

                        private static final long serialVersionUID = 1L;

                        @Override
                        protected void populateItem(final Item item) {
                                item.add(new AjaxLink("showTemplateLink",
item.getModel())
                                {
                                        public void
onClick(AjaxRequestTarget target)
                                        {
                                                Notification obj =
(Notification)getParent().getModelObject();
                                                // here i would like to
pass the obj value to modal window, how do i
achieve this?
                                                templateModal.show
(target);

                                        }
                                });
                        }
                }
        dataView.setOutputMarkupId(true);
        add(dataView);
        }
}

this is my partial codes of TemplateModalPage:

public class TemplateModalPage extends WebPage{

        public TemplateModalPage(TableViewPage tableViewPage, ModalWindow
templateModal){
                add(new TemplateForm("templateForm", tableViewPage));
        }

        private class TemplateForm extends Form{
                private AjaxSubmitButton submitButton;
                private AjaxSubmitButton cancelButton;
                private TextField templateTextField;

                public TemplateForm(String id, final TableViewPage
tableViewPage) {
                        super(id);

                        CompoundPropertyModel model = new
CompoundPropertyModel(this);
                        setModel(model);

                        templateTextField = new TextField("template");
                        add(templateTextField);

                       //here i suppose to get the templateId (from
DataView) before i update the latest changes to the table...

                        submitButton = new
AjaxSubmitButton("submitButton", this){
                                @Override
                                protected void onSubmit(AjaxRequestTarget
target, Form form) {

                                        try {

TemplateManager.getInstance().updateTemplate(persistence, aTransient);

                                        } catch (Exception e) {

                                                e.printStackTrace();
                                                error(e.getMessage());
                                        }
                                        ModalWindow.close(target);
                                }
                        }
                        add(submitButton);
                }
        }
}

Thanks.

--
View this message in context:
http://www.nabble.com/Pass-value-of-the-selected-item-from-DataView-to-the-modal-window-tf4072118.html#a11572811
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to