modal window navigation?

View: New views
4 Messages — Rating Filter:   Alert me  

modal window navigation?

by Ryan McKinley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello-

I'm using a Page within a modal window and when the user clicks an  
'OK' button, I want to refresh the whole page (not the modal window).  
I've tried a few variations of:

     form.add( new AjaxButton("actionSave")
     {
       @Override
       protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
         getRequestCycle().setResponsePage( ExplorePage.class );
       }
     });

but that refreshes the iframe, not the page.

Any pointers?

For extra credit...  what is the easiest way to make the modal window  
background darker?  Do I need to extend the modal window and include a  
different CSS file?  what is the best practice for this kind of thing?

thanks!
ryan

Re: modal window navigation?

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you want to refresh the page that contains the modal window? in that
case you will have to do something like:
onsubmit(ajaxrequesttarget target) {
 target.appendjavascript("window.top.location="+urlfor(Explorepage.class,
null)); }

-igor

On Sat, Jul 19, 2008 at 11:19 PM, Ryan McKinley <ryan@...> wrote:

> Hello-
>
> I'm using a Page within a modal window and when the user clicks an 'OK'
> button, I want to refresh the whole page (not the modal window). I've tried
> a few variations of:
>
>    form.add( new AjaxButton("actionSave")
>    {
>      @Override
>      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>        getRequestCycle().setResponsePage( ExplorePage.class );
>      }
>    });
>
> but that refreshes the iframe, not the page.
>
> Any pointers?
>
> For extra credit...  what is the easiest way to make the modal window
> background darker?  Do I need to extend the modal window and include a
> different CSS file?  what is the best practice for this kind of thing?
>
> thanks!
> ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: modal window navigation?

by Ladislav Thon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm using a Page within a modal window and when the user clicks an 'OK'

> button, I want to refresh the whole page (not the modal window). I've tried
> a few variations of:
>
>    form.add( new AjaxButton("actionSave")
>    {
>      @Override
>      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>        getRequestCycle().setResponsePage( ExplorePage.class );
>      }
>    });
>
> but that refreshes the iframe, not the page.
>

I had the same "problem" few days ago. You should create a
WindowClosedCallback and call setResponsePage in there, presumably after
checking some variable set by the button's onSubmit. At least this worked
for me :-)

LT


>
> Any pointers?
>
> For extra credit...  what is the easiest way to make the modal window
> background darker?  Do I need to extend the modal window and include a
> different CSS file?  what is the best practice for this kind of thing?
>
> thanks!
> ryan

Re: modal window navigation?

by Mr Mean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> For extra credit...  what is the easiest way to make the modal window
> background darker?  Do I need to extend the modal window and include a
> different CSS file?  what is the best practice for this kind of thing?
>
> thanks!
> ryan

Making the background darker is a bit tricky but it can be done in the
following way. Note that this has only been tested on a modalwindow
with a panel, not with a page as content.
In the parent page include the following javascript.
/**
 * Changes the style of the mask used by the modal window.
 */
function changeMaskStyle(style)
{
 var myWindow=Wicket.Window.get();
 if(myWindow)
 {
  while(myWindow.oldWindow)
   myWindow=myWindow.oldWindow;
  if(myWindow.mask)
  {
   if(myWindow.mask.element)
    myWindow.mask.element.className=style;
  }
 }
}

In the ajax call that shows the modalwindow do this:
target.appendJavascript("changeMaskStyle('wicket-mask-extra-dark');");

Don't forget to change it back when you close the modalwindow
target.appendJavascript("changeMaskStyle('wicket-mask-dark');"); //or
transparant

Somewhere in your css include this:
div.wicket-mask-extra-dark {
        position: fixed;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
        opacity: 0.9;
        -moz-opacity:0.9;
        background-color: black;
        filter: alpha(opacity=90);
        background-image: url('transparent2.png');
}


Unless i am forgetting something that should be it :)

Maurice

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price