PDA

View Full Version : Refresh my page



rakir
12 Jun 2009, 4:56 AM
Hi everybody

I want to refresh my page (F5 behavior) whern i click on a button but i don't know how to do this.

If anyone knows ...

I know that for gxt 1.x, i have to make : XDOM.reload but, nothing happens with that code with gxt 2

Thx a lot

Jose Jeria
12 Jun 2009, 1:59 PM
I found this solution (http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/1e14adc1757bfba2?pli=1) using Google.

:)

Miggins
12 Jun 2009, 2:27 PM
You can also use:


Window.Location.reload();

sven
12 Jun 2009, 2:30 PM
XDOM.reload(); works fine for me. I just tested it afew times.

gaspo100
16 Jun 2009, 6:29 AM
On another note, is there a way to prevent the page refresh when F5 is clicked? Currently when user presses F5 in the browser the whole application reloads and the user gets thrown back to the login screen. I need to stop the browser from refreshing the pages.

Colin Alworth
17 Jun 2009, 6:20 AM
I'd recommend looking into the GWT History class, and using that to maintain state...

mschwartz
17 Jun 2009, 6:33 AM
Browsers have an onBeforeUnload event.

You can only have the browser pop up a native confirm dialog to avoid reloading or browsing away from the page.

Something like this:


Ext.EventManager.on(window, 'beforeunload', function(e) {
e.browserEvent.returnValue = 'You have unsaved changes... Press OK to quit anyway.';
});


Obviously do some logic to decide if you want to do the e.browserEvent.returnValue thing.

gaspo100
17 Jun 2009, 4:22 PM
Thanks for the tip with onbeforeunload.
I could not find Ext.EventManager.on equivalent in GXT so I put this into my application's html page:


<script type="text/javascript" language="javascript">
var unloadMsg = '';

function handleBeforeUnload()
{
if (unloadMsg.length > 0)
return unloadMsg;
}

window.onbeforeunload = handleBeforeUnload;
</script>

and then in my code I use this native method to set or clear the unload message as appropriate:

native private static void setUnloadMsg(String msg) /*-{ $wnd.unloadMsg = msg; }-*/;

Colin Alworth
18 Jun 2009, 5:40 AM
Try com.google.gwt.user.client.Window.addCloseHandler() - I think this is what you are looking for. RootPanel uses this to detach the objects it builds/finds from the DOM in RootPanel.hookWindowClosing().

sami_sahli
8 Apr 2010, 3:06 AM
Is there a way to prevent the page refresh when you click on F5? Currently, when the user presses F5 in the browser to reload the entire application and the user is returned to the login screen. I need that when you click F5 and all tabpanel tabs remain open.

sami_sahli
8 Apr 2010, 3:12 AM
Is there a way to prevent the page refresh when you click on F5? Currently, when the user presses F5 in the browser to reload the entire application and the user is returned to the login screen. I need that when you click F5 and all tabpanel tabs remain open.

sven
8 Apr 2010, 3:14 AM
You should not prevent someone from hitting F5. You should implement proper state and history managemant within your application.

kiran-gxt
27 May 2010, 3:17 AM
You should not prevent someone from hitting F5. You should implement proper state and history managemant within your application.

But when we do refresh or f5 we lose all the values set in registry. Without the temporary cached values how can we bring back the state.Please can you help me?

sven
27 May 2010, 3:21 AM
What are you doing if the browser crashes? how are you restoring the state than? Save the state in a place, where it persits such actions.

kiran-gxt
27 May 2010, 10:16 PM
Hi
I think when browser crashes.It only remembers the URL and then it tries to load the page with the last saved URL.
Does it store all the cache.
example Does it store all cache set using Registry.register.