I came to a similar conclusion shortly before reading this.

So now I seem to be updating in the correct place, but I'm having
trouble getting the image component to swap out within the
onClose(AjaxRequestTarget pTarget)

Inside the ModalWindow, assuming I previously did a setOutputMarkupId
on the original component, something like this works:

Component newComponent = new Component();
origComponent.replaceWith(newComponent);
origComponent = newComponent;

Should I be able to do something similar inside the onClose, and get
Ajax to replace the component? I add both the old and the new object
to the AjaxRequestTarget w/ addComponent, but it doesn't seem to be
updating properly...




On 10/23/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
> Problem is that AjaxRequestTarget only applies to one page. If you
> want to update the outer page (assuming that you have another page
> inside modal window, not a panel), the only way to do it is from
> within WindowClosedCallback registered to modal window. So you have to
> mark somehow dirty components on parent page and then update those
> when modal window closes.
>
> -Matej
>
> On 10/23/07, Kirk Israel <[EMAIL PROTECTED]> wrote:
> > So I spoke too soon about this working out... I think the core problem
> > is kind of simple:
> > How can a component of a page inside a ModalWindow update components
> > on the page that holds the Modal Window?
> >
> > More Specifically:
> > I have an "EditCreativePage" that creates an instance of
> > "UploadMediaPanelPage", then creates a ModalWindow with a createPage()
> > that gets the instance of the  "UploadMediaPanelPage".
> > "EditCreativePage" has a "MediaPanel" that has a link that sets a
> > callback inside of "UploadMediaPanelPage" and calls the
> > ModalWindow.show()
> >
> > "UploadMediaPanelPage" has an upload Form, whose onSubmit seems to do
> > a fine job of parsing data of the uploaded image, and shows a preview
> > panel w/ the image etc. "UploadMediaPanelPage" also has its own
> > AjaxLinks for "Ok" and "Cancel" - when I pass the AjaxRequestTarget
> > the onClick for OK gets back to the "MediaPanel", and it tries to
> > update itself and its embedded ImageComponent.
> >
> > Now, when I forget to call MediaPanel.setOutputMarkupId(true), the
> > ModalWindow shows the exception
> >
> >  java.lang.IllegalArgumentException: cannot update component that does
> > not have setOutputMarkupId property set to true.
> >
> > when I do call MediaPanel.setOutputMarkupId(true), there's no
> > exception, but the Ajax Debug window *inside the ModalWindow* shows
> > something like
> >
> > ERROR: Component with id [[mediaimage40]] a was not found while trying
> > to perform markup update. Make sure you called
> > component.setOutputMarkupId(true) on the component whose markup you
> > are trying to update.
> >
> > and nothing shows up in th Ajax Debug of "EditCreativePage", which is
> > probably the problem...
> >
> > Is there a work around for this? Either direct, or do I need to
> > somehow override the ModalWindow setWindowClosedCallback ? But in that
> > case, what do I use for an AjaxRequestTarget ?
> >
> > Thanks for any help...
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to