Hi, i'm new to wicket, i'm currently using wicket 1.3.4. 

Probably i need a simple thing and done some mistake.

I have searched from wicket forum like
http://www.nabble.com/Pass-form-input-from-modal-window-back-to-the-caller-page-td14944556.html
http://markmail.org/message/mksmlefsd6wbjycc?q=setWindowClosedCallback#query:setWindowClosedCallback+page:1+mid:hitb2xps4rxw4vq4+state:results

and went through modal window setWindowClosedCallback, ajax-enabled
radioGroup, 
wicket live example etc. But i still could not figure out the solution
myself yet. 

Appreciate anyone inputs and give me some valuable pointer. Thanks alot.

-       In my 1st page, there is a form with many formcomponents, including a
Ajaxlink to show up a modal window.

-       That link opens a modal window in 2nd page and i can submit a search 
query
in the form, after submitted, it will redirect to 3rd page. 

-       In my 3rd page, search results will be return from database and 
displayed
at dataView. 

-       Now, I can select which row of search result using radioGroup and call 
the
ajaxSubmitButton to submit the form.

-       After i selected the row, the Modal window is closed & supposely the
selected row will be return &  display back to my 1st page.

Below is my code snippet, I having a problem to return back the selected row
from my dataView to the 1st page & display at one of the caller's page
textBox.
What have i done wrong?

1st Page 
=======
modal1.setPageCreator(new ModalWindow.PageCreator()
{
        public Page createPage()
         {
                        return new ModalContent1Page(firstPage.this, modal1);
        }
});


2nd Page appear at Modal Window
==========================
public ModalContent1Page(final FirstPage firstPage, final ModalWindow
window)
{
        private class SearchForm extends Form{

                public SearchForm(String id, FirstPage firstPage) {
                
                        searchButton = new AjaxSubmitButton("searchButton", 
this){
                        @Override
                        protected void onSubmit(AjaxRequestTarget target, Form 
form) {
                                        
                                target.addComponent(feedback);
                                        
                                SearchResultPage searchResultPage = new 
SearchResultPage(code);
                                setResponsePage(searchResultPage );
                                                
                                
                        }
                };
                        
        add(searchButton);
        }
        
}

3rd Page appear at Modal Window
==========================
dataView = new DataView("tableForm", dataProvider){
        
        @Override
        protected void populateItem(final Item item) {
                                        
                // TODO Auto-generated method stub
                                        
                user= (User)item.getModelObject();
                                        
                item.add(radio = new Radio("radio", item.getModel()));
                                        
                radio.add(new AjaxEventBehavior("onchange") {
                                                    

                        protected void onEvent(AjaxRequestTarget target) {
                                          
getComponent().getModelObject().toString());

                                  //value = 
getComponent().getModelObject().toString();
                                              
                                  user= (User) getComponent().getModelObject();
                                                                      
                                  System.out.println("User is   "+user);
                                                                      
                                  group.setModelObject(user);
                                                                      
                        }
                }); 
                radio.setOutputMarkupId(true);
        };
        dataView.setOutputMarkupId(true);
        add(dataView);

        group.add(dataView);

        submitButton = new AjaxSubmitButton("submitButton", (Form)
getModelObject()){
        
                @Override
                protected void onSubmit(AjaxRequestTarget target, Form form) {
                        // TODO Auto-generated method stub
                        
                        // Is this the correct way to set the selected row 
value to Model Object?
If not, what will it be?                        
                        group.setModelObject(user);
                
                        ModalWindow.closeCurrent(target); 
                        
                }
        };
                        
        add(submitButton);
                        
        }

}



1st Page - modalWindow closed call back to update the selected row value to
textbox.
==================================================================
modal1.setWindowClosedCallback(new ModalWindow.WindowClosedCallback()
{
                    public void onClose(AjaxRequestTarget target)
                    {
                
                // Is this the correct way to get the selected row value from 
Model
Object? If not, what will it be?

                codeField.setModelObject(modal1.getModelObject());
                        target.addComponent(codeField);
                        
                    }
});

Thank you for your time.


-- 
View this message in context: 
http://www.nabble.com/Having-problem-in-modal-window.setWindowClosedCallback-tp18664531p18664531.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to