You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2015/06/15 03:15:14 UTC

Wicket modal, change the parent page

I have a wicket modal that is used to let the user select from a couple
options on a popup button.  On close, depending on what button they hit on
the popup, I need to run a javascript event on the calling page as I close
the window, AND I need to alter a label and ExternalLink on the parent page.

But wicket is largely ignoring me.  I used target.appendJavascript() to
invoke the javascript method, yet it never gets invoked.  I also
setOutputMarkupId on the controls I need to update (and their parent
container in fact), and I added all to the target.  I changed their models
to affect their content.  So label.setDefaultModel(new Model("newValue"))
for example, and for the ExternalLink, I used the same to affect the url,
and used setBody("newValue") to change the body of the link.

Am I doing to wrong?  This is all in response to a button in the modal, so I
thought maybe the target is the wrong target.  I saw an example where
someone used ModalWindow.WindowClosedCallback, and so i moved the logic into
that event, using that target, and still, nothing seems to update on the
front end.

So I must be doing it wrong.  Advice?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-modal-change-the-parent-page-tp4671163.html
Sent from the Users forum 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


Re: Wicket modal, change the parent page

Posted by Entropy <bl...@gmail.com>.
Yes, the method is called, and yes the modal closes.  However, in the same
event as the closing modal, I need to let the parent page update itself
based on what the user did.  And that's the part that doesn't work.

A quickstart would be hard because this is in the middle of a large workflow
with lots of stuff that probably isn't relevant to the issue because it was
already there.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-modal-change-the-parent-page-tp4671163p4671167.html
Sent from the Users forum 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


Re: Wicket modal, change the parent page

Posted by Sven Meier <sv...@meiers.net>.
Hi,

did you debug the problem? Is your button's hook method #onSubmit() 
called actually?
Does the modal window close?

A quickstart would help to identify the problem.

Sven

On 15.06.2015 03:15, Entropy wrote:
> I have a wicket modal that is used to let the user select from a couple
> options on a popup button.  On close, depending on what button they hit on
> the popup, I need to run a javascript event on the calling page as I close
> the window, AND I need to alter a label and ExternalLink on the parent page.
>
> But wicket is largely ignoring me.  I used target.appendJavascript() to
> invoke the javascript method, yet it never gets invoked.  I also
> setOutputMarkupId on the controls I need to update (and their parent
> container in fact), and I added all to the target.  I changed their models
> to affect their content.  So label.setDefaultModel(new Model("newValue"))
> for example, and for the ExternalLink, I used the same to affect the url,
> and used setBody("newValue") to change the body of the link.
>
> Am I doing to wrong?  This is all in response to a button in the modal, so I
> thought maybe the target is the wrong target.  I saw an example where
> someone used ModalWindow.WindowClosedCallback, and so i moved the logic into
> that event, using that target, and still, nothing seems to update on the
> front end.
>
> So I must be doing it wrong.  Advice?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-modal-change-the-parent-page-tp4671163.html
> Sent from the Users forum 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


Re: Wicket modal, change the parent page

Posted by Entropy <bl...@gmail.com>.
That is correct, my modal shows a page.  I wasn't aware a modal could show
just a panel.  I will look into this.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-modal-change-the-parent-page-tp4671163p4671168.html
Sent from the Users forum 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


Re: Wicket modal, change the parent page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Most probably you use ModalWindow with a Page. This page has its own
JavaScript 'document' that is completely different than the 'document' of
the parent page. I.e. document.getElementById('someId') will not find the
element.
Using ModalWindow with a Panel as content would work for your use case.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Jun 15, 2015 at 4:15 AM, Entropy <bl...@gmail.com> wrote:

> I have a wicket modal that is used to let the user select from a couple
> options on a popup button.  On close, depending on what button they hit on
> the popup, I need to run a javascript event on the calling page as I close
> the window, AND I need to alter a label and ExternalLink on the parent
> page.
>
> But wicket is largely ignoring me.  I used target.appendJavascript() to
> invoke the javascript method, yet it never gets invoked.  I also
> setOutputMarkupId on the controls I need to update (and their parent
> container in fact), and I added all to the target.  I changed their models
> to affect their content.  So label.setDefaultModel(new Model("newValue"))
> for example, and for the ExternalLink, I used the same to affect the url,
> and used setBody("newValue") to change the body of the link.
>
> Am I doing to wrong?  This is all in response to a button in the modal, so
> I
> thought maybe the target is the wrong target.  I saw an example where
> someone used ModalWindow.WindowClosedCallback, and so i moved the logic
> into
> that event, using that target, and still, nothing seems to update on the
> front end.
>
> So I must be doing it wrong.  Advice?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-modal-change-the-parent-page-tp4671163.html
> Sent from the Users forum 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
>
>