You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jeross <jr...@greenenergycorp.com> on 2011/05/03 19:05:44 UTC

Modal window update once opened

I am new to Wicket and am having difficulty figuring out how to update a
modal window without closing it and reopening it.  I've seen similar posts
but have not found the answer as of yet.  We are using Wicket 1.4.7. The
scenario is that I have a ModalWindow component that is part of form.  The
ModalWindow is acting as a progress dialog and displays the step and some
information in the title and a message field.  On the parent form that
contains the modal window, I have an AjaxSelfUpdatingTimerBehavior with a
simple state machine.  I want to keep the modal window open and change the
title and message text as things progress in the state machine.  I've tried
a number of things, but I cannot get the text or title to update on the
modal window.  The basic code that I have is:

/* HTML for ModalWindow */
<wicket:panel>

    <table width="100%">
        <tr>
            <td></td>
        </tr>
    </table>
</wicket:panel>

/* the modal window is already displayed when the timer fires the first time
*/
                        timerBehavior = new
AjaxSelfUpdatingTimerBehavior(Duration.seconds(REFRESH_RATE))
                        {
                            private static final long serialVersionUID =
4618003750684232624L;

                            @Override
                            protected void
onPostProcessTarget(AjaxRequestTarget timerTarget)
                            {
                                if (state == DeviceProgressEnum.PREPARE)
                                { 
                                    /* lines deleted */
                                    state = DeviceProgressEnum.PREPARE_WAIT;
                                    modalWindow.setMessage("Please wait
while we prepare...");
                                    modalWindow.setTitle("Step 1 of 3");
                                    modalWindow.show(timerTarget);
                                   /* also tried: 
timerTarget.add(modalWindow);
                                }
                                    /* lines deleted */
                        } 

How can I update a modal window once it has been opened? What am I doing
wrong?

Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Modal-window-update-once-opened-tp3493014p3493014.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: Modal window update once opened

Posted by Isammoc OFF <is...@gmail.com>.
Sounds weird about two divs with same id.

At first glance, it looks like a bug.

Can someone confirm ?


2011/5/3 jeross <jr...@greenenergycorp.com>

>  Thank you for your quick reply.
>  I had the modalWindow.setOutputMarkupId(true) as well as on the message
> label on the modalWindow. I tried the timerTarget.addComponent(modalWindow)
> in the onPostProcessTarget.  No luck.
>  When I look at the rendered HTML, I see two different content area divs
> for the modal window and both have the same id.  One is rendered as part of
> the parent form with display:none, and the other is rendered in a bunch of
> divs for the modal window outside of the parent form.  The content of the
> first div with the display:none is changed with the new message label.  The
> content of the content div in the modal window, which is displayed, is not
> changed.  Hmm.
>   Is there something special about refreshing the content of the
> modalWindow versus other components?
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Modal-window-update-once-opened-tp3493014p3493484.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: Modal window update once opened

Posted by jeross <jr...@greenenergycorp.com>.
  Thank you for your quick reply.
  I had the modalWindow.setOutputMarkupId(true) as well as on the message
label on the modalWindow. I tried the timerTarget.addComponent(modalWindow)
in the onPostProcessTarget.  No luck.  
  When I look at the rendered HTML, I see two different content area divs
for the modal window and both have the same id.  One is rendered as part of
the parent form with display:none, and the other is rendered in a bunch of
divs for the modal window outside of the parent form.  The content of the
first div with the display:none is changed with the new message label.  The
content of the content div in the modal window, which is displayed, is not
changed.  Hmm.
   Is there something special about refreshing the content of the
modalWindow versus other components?
  

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Modal-window-update-once-opened-tp3493014p3493484.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: Modal window update once opened

Posted by Isammoc OFF <is...@gmail.com>.
In onPostProcessTarget :
timerTarget.add(modalWindow)

You have to add components you are refreshing to the AjaxRequestTarget instance.

Don't forget to set markupId to true for modalWindow
modalWindow.setMarkupId(true);
when you add it to the parent component.


2011/5/3 jeross <jr...@greenenergycorp.com>:
> I am new to Wicket and am having difficulty figuring out how to update a
> modal window without closing it and reopening it.  I've seen similar posts
> but have not found the answer as of yet.  We are using Wicket 1.4.7. The
> scenario is that I have a ModalWindow component that is part of form.  The
> ModalWindow is acting as a progress dialog and displays the step and some
> information in the title and a message field.  On the parent form that
> contains the modal window, I have an AjaxSelfUpdatingTimerBehavior with a
> simple state machine.  I want to keep the modal window open and change the
> title and message text as things progress in the state machine.  I've tried
> a number of things, but I cannot get the text or title to update on the
> modal window.  The basic code that I have is:
>
> /* HTML for ModalWindow */
> <wicket:panel>
>
>    <table width="100%">
>        <tr>
>            <td></td>
>        </tr>
>    </table>
> </wicket:panel>
>
> /* the modal window is already displayed when the timer fires the first time
> */
>                        timerBehavior = new
> AjaxSelfUpdatingTimerBehavior(Duration.seconds(REFRESH_RATE))
>                        {
>                            private static final long serialVersionUID =
> 4618003750684232624L;
>
>                            @Override
>                            protected void
> onPostProcessTarget(AjaxRequestTarget timerTarget)
>                            {
>                                if (state == DeviceProgressEnum.PREPARE)
>                                {
>                                    /* lines deleted */
>                                    state = DeviceProgressEnum.PREPARE_WAIT;
>                                    modalWindow.setMessage("Please wait
> while we prepare...");
>                                    modalWindow.setTitle("Step 1 of 3");
>                                    modalWindow.show(timerTarget);
>                                   /* also tried:
> timerTarget.add(modalWindow);
>                                }
>                                    /* lines deleted */
>                        }
>
> How can I update a modal window once it has been opened? What am I doing
> wrong?
>
> Thanks!
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Modal-window-update-once-opened-tp3493014p3493014.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