Discussion:
Force page refresh after Ajax request completes?
dukejansen
2007-05-09 07:55:04 UTC
Permalink
Anyone have any recommendations for how I would go about getting my Ajax
event handler method to trigger a refresh of the current page on the client
side after it is done with the Ajax request? My Ajax event handler needs to
first close the current modal window and then refresh the entire page.

I've tried:

ModalWindow.closeCurrent(target);
target.appendJavascript("window.location.reload()");

But I get the Javascript popup client side warning me that I'm navigating
away from a page while a modal window is still open. Seems like a bug. Is
there a better way to do this?

-Jason
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10389905
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Eelco Hillenius
2007-05-09 08:47:59 UTC
Permalink
Is there a better way to do this?
Yep. Just call setResponsePage(MyPage.this) or
RequestCycle.get().setResponsePage or something similar. Only works in
1.3 I think.

Eelco

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Arnout Engelen
2007-05-09 08:52:39 UTC
Permalink
Post by Eelco Hillenius
Is there a better way to do this?
Yep. Just call setResponsePage(MyPage.this) or
RequestCycle.get().setResponsePage or something similar. Only works in
1.3 I think.
Wouldn't that open MyPage inside the ModalWindow, since the javascript
for closing the ModalWindow was added to the AjaxRequestTarget which
gets ignored because of the setResponsePage()?


Arnout
Eelco Hillenius
2007-05-09 09:42:48 UTC
Permalink
Ah. Maybe next time I'll try to acually read the whole email instead
of just the subject :) Sorry.

Matej, or anyone else with knowledge of modal windows... any ideas?

Eelco
Is there a better way to do this?
Yep. Just call setResponsePage(MyPage.this) or
RequestCycle.get().setResponsePage or something similar. Only works in
1.3 I think.
Wouldn't that open MyPage inside the ModalWindow, since the javascript for
closing the ModalWindow was added to the AjaxRequestTarget which gets
ignored because of the setResponsePage()?
Arnout
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Arnout Engelen
2007-05-09 09:51:47 UTC
Permalink
My Ajax event handler needs to first close the current modal window and then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in the
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in this
area :).


Arnout

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Matej Knopp
2007-05-09 12:48:20 UTC
Permalink
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
window:
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>

-Matej
Post by Arnout Engelen
My Ajax event handler needs to first close the current modal window and then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in the
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in this
area :).
Arnout
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
dukejansen
2007-05-09 18:50:23 UTC
Permalink
Yeah, but I don't want to disable that warning. That warning is valid if the
user really does try to navigate away while the modal is still being
displayed.

The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.

-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal window and
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in the
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in this
area :).
Arnout
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Matej Knopp
2007-05-09 19:33:52 UTC
Permalink
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.

-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid if the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal window and
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in the
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in this
area :).
Arnout
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
dukejansen
2007-05-10 16:58:16 UTC
Permalink
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing the
setResponsePage server side...? Since I'm appending that Javascript AFTER
the 'close modal window' call, it seems like it should be able to close the
modal window client side, THEN call my javascript to refresh the page,
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid if the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal window
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in this
area :).
Arnout
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10417476
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
dukejansen
2007-05-31 16:09:21 UTC
Permalink
Any chance anyone has any input on this? I still think this is a bug in
Wicket, that I can't set Javascript to reload the page after the modal
window is closed, since the page still thinks the modal is open.
Post by dukejansen
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing the
setResponsePage server side...? Since I'm appending that Javascript AFTER
the 'close modal window' call, it seems like it should be able to close
the modal window client side, THEN call my javascript to refresh the page,
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid if the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal window
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in
this
Post by Matej Knopp
area :).
Arnout
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
James McLaughlin
2007-05-31 17:30:33 UTC
Permalink
Its a shameless hack, but you could try it in a setTimeout. Or possibly,
target.appendJavascript("Wicket.Window.unloadConfirmation=false;window.location.reload()")
Otherwise, I believe the semantics of onClose make it necessary for
the modal to be around until onClose returns.

hth,

jim
Post by dukejansen
Any chance anyone has any input on this? I still think this is a bug in
Wicket, that I can't set Javascript to reload the page after the modal
window is closed, since the page still thinks the modal is open.
Post by dukejansen
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing the
setResponsePage server side...? Since I'm appending that Javascript AFTER
the 'close modal window' call, it seems like it should be able to close
the modal window client side, THEN call my javascript to refresh the page,
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid if the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal window
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect in
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in our
case, but I too would be interested in some more enlightenment in
this
Post by Matej Knopp
area :).
Arnout
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
dukejansen
2007-06-28 18:40:58 UTC
Permalink
Tried this. It still gives the warning. :(
Post by James McLaughlin
Its a shameless hack, but you could try it in a setTimeout. Or possibly,
target.appendJavascript("Wicket.Window.unloadConfirmation=false;window.location.reload()")
Otherwise, I believe the semantics of onClose make it necessary for
the modal to be around until onClose returns.
hth,
jim
Post by dukejansen
Any chance anyone has any input on this? I still think this is a bug in
Wicket, that I can't set Javascript to reload the page after the modal
window is closed, since the page still thinks the modal is open.
Post by dukejansen
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing
the
Post by dukejansen
setResponsePage server side...? Since I'm appending that Javascript
AFTER
Post by dukejansen
the 'close modal window' call, it seems like it should be able to close
the modal window client side, THEN call my javascript to refresh the
page,
Post by dukejansen
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid
if
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal
window
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect
in
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in
our
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
case, but I too would be interested in some more enlightenment in
this
Post by Matej Knopp
area :).
Arnout
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a11348556
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Matej Knopp
2007-06-28 19:20:59 UTC
Permalink
Then you might need to update wicket.

-Matej
Post by dukejansen
Tried this. It still gives the warning. :(
Post by James McLaughlin
Its a shameless hack, but you could try it in a setTimeout. Or possibly,
target.appendJavascript("Wicket.Window.unloadConfirmation=false;window.location.reload()")
Otherwise, I believe the semantics of onClose make it necessary for
the modal to be around until onClose returns.
hth,
jim
Post by dukejansen
Any chance anyone has any input on this? I still think this is a bug in
Wicket, that I can't set Javascript to reload the page after the modal
window is closed, since the page still thinks the modal is open.
Post by dukejansen
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing
the
Post by dukejansen
setResponsePage server side...? Since I'm appending that Javascript
AFTER
Post by dukejansen
the 'close modal window' call, it seems like it should be able to close
the modal window client side, THEN call my javascript to refresh the
page,
Post by dukejansen
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is valid
if
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with modal
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal
window
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect
in
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in
our
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
case, but I too would be interested in some more enlightenment in
this
Post by Matej Knopp
area :).
Arnout
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a11348556
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
dukejansen
2007-06-28 19:48:05 UTC
Permalink
Figured this out.

Setting the unloadConfirmation to false here is useless, because Wicket only
examines that boolean in its show() method for the modal, at which point it
sets up unload event handlers based on true/false.

That event handler is already set by this point, so changing the boolean
here is too late.

To work around this, I had to actually redefine the window.onunload myself
to replace Wicket's handler.

This seems to work.

A better fix might be to alter the unload event handler which does the
warning to first check the value of the boolean, in case the user has reset
it, and if the user has reset it, skip the warning.
Post by dukejansen
Tried this. It still gives the warning. :(
Post by James McLaughlin
Its a shameless hack, but you could try it in a setTimeout. Or possibly,
target.appendJavascript("Wicket.Window.unloadConfirmation=false;window.location.reload()")
Otherwise, I believe the semantics of onClose make it necessary for
the modal to be around until onClose returns.
hth,
jim
Post by dukejansen
Any chance anyone has any input on this? I still think this is a bug in
Wicket, that I can't set Javascript to reload the page after the modal
window is closed, since the page still thinks the modal is open.
Post by dukejansen
Yup. That's why I was trying to do it using
target.appendJavascript("window.location.reload()") instead of doing
the
Post by dukejansen
setResponsePage server side...? Since I'm appending that Javascript
AFTER
Post by dukejansen
the 'close modal window' call, it seems like it should be able to
close
Post by dukejansen
the modal window client side, THEN call my javascript to refresh the
page,
Post by dukejansen
without the warning, since the modal has been closed.. ?
Post by Matej Knopp
The problem is that when setResponsePage() is called, no appended
Javascript is evaluated. In fact, wicket doesn't process the ajax
response at all. Just sets window.location.
-Matej
Post by dukejansen
Yeah, but I don't want to disable that warning. That warning is
valid if
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
user really does try to navigate away while the modal is still being
displayed.
The problem is that I am actually closing the modal before I do the
redirect, so it shouldn't show the warning at all.
-Jason
Post by Matej Knopp
There is a way that should also work in recent 1.x. To disable the
confirmation dialog you need to put this inside the page with
modal
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
<script type="text/javascript">
Wicket.Window.unloadConfirmation=false;
</script>
-Matej
My Ajax event handler needs to first close the current modal
window
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
and
Post by Matej Knopp
then refresh the entire page. Is there a better way to do this?
I once worked around something like this by putting the redirect
in
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
the
Post by Matej Knopp
windowClosedCallback of the ModalWindow. That was sufficient in
our
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
case, but I too would be interested in some more enlightenment in
this
Post by Matej Knopp
area :).
Arnout
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
Post by dukejansen
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Post by dukejansen
Post by Matej Knopp
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
View this message in context: http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a11349738
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Loading...