Component I want to update is in a Panel contained in the main page.  So, no
access to this component from the cancel button on the ModalWindow. 

Should I be passing the Panel to the ModalWindow in the constructor so I can
access its components?


Steve






damnitjim wrote:
> 
> Have you tried adding target.addComponent() call in the CancelButton
> submit
> ?
> 
> On Mon, Jul 28, 2008 at 4:19 PM, steve222 <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Hi. Using Wicket 1.3.4.
>>
>> I have a main page with a panel.  Page contains a form for editing a main
>> record.  Panel contains a DataView containing a list of related sub
>> records.
>> In the java code for the pabel, create a ModalWindow and pop this for
>> adding
>> more sub-records.  Uses AJAX.
>>
>> Got this working OK similar to:
>>
>>
>> Main page code:
>>
>>
>>        public MainRecordEdit(PageParameters p) {
>>
>>                Integer id = p.getInt("mainRecord");
>>
>>                // uses application scope Spring bean to get record from
>> database
>>                final MyRecord myRecord = getRecordManager().findById(id);
>>
>>                ...
>>                // stuff form main record CRUD on main page
>>                ...
>>
>>
>>                // add the panel for the sub records
>>                add(new MyListingPanel("myListingPanel", myRecord));
>>
>>        }
>>
>>
>>
>> Panel code for sub records:
>>
>>    public MyListingPanel(String id, final MyRecord myRecord) {
>>
>>        super(id);
>>
>>        Collection mySubs = myRecord.getSubRecords();
>>
>>        DataView dataView = new DataView("dataView", new
>> ListDataProvider(new
>> ArrayList(mySubs))) {
>>
>>                public void populateItem(final Item item) {
>>                        final MySub ms = (MyRecord) item.getModelObject();
>>                        item.add(new Label("id", ms.getId()));
>>                        ...
>>                }
>>        };
>>
>>        final WebMarkupContainer listContainer = new
>> WebMarkupContainer("theContainer");
>>
>>        listContainer.setOutputMarkupId(true);
>>        listContainer.add(dataView);
>>
>>       ...
>>
>>       payawayWindow.setWindowClosedCallback(new
>> ModalWindow.WindowClosedCallback() {
>>                public void onClose(AjaxRequestTarget target) {
>>
>>                        // not sure what to put here to refresh the list
>> in
>> dataview
>>
>>                        target.addComponent(listContainer);
>>                }
>>        });
>>
>>
>>       final ModalWindow modalWindow = new ModalWindow("modalWindow");
>>       modalWindow.setOutputMarkupId(true);
>>       add(modalWindow);
>>
>>       add(new AjaxLink("modalLink") {
>>               public void onClick(AjaxRequestTarget target) {
>>                        modalWindowshow(target);
>>                }
>>        });
>>
>>
>> In the jave code for the Modal window - also a Panel - I do normal CRUD
>> stuff via AJAX with feedback going into a FeedbackPanel on the modal
>> window
>> panel when I save (or hit validation errors).  No problems here - my AJAX
>> updates work OK.
>>
>> I close the popup panel using a button:
>>
>>               private void addCancelButton(Form form, final ModalWindow
>> window) {
>>
>>                        AjaxFallbackButton cancel = new
>> AjaxFallbackButton("cancelbutton", form)
>> {
>>
>>                                @Override
>>                                protected void onSubmit(AjaxRequestTarget
>> target, Form form) {
>>
>>                                        // not sure if I need to do
>> anything
>> here to make the new
>>                                        // sub record appear on main page
>> when I close this window
>>
>>                                        info("Cancel was pressed!");
>>                                        window.close(target);
>>                                }
>>                        };
>>
>>                        cancel.setDefaultFormProcessing(false);
>>                        form.add(cancel);
>>                }
>>
>>
>> Window closes.  Main page does not show new sub record in the DataView on
>> the main Panel.
>>
>> Page refresh reloads the list OK.
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Modal-window---update-main-page-on-close-tp18701883p18701883.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]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modal-window---update-main-page-on-close-tp18701883p18718430.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