-
12 Jun 2009 4:56 AM #1
Refresh my page
Refresh my page
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
-
12 Jun 2009 1:59 PM #2
-
12 Jun 2009 2:27 PM #3
You can also use:
Code:Window.Location.reload();
-
12 Jun 2009 2:30 PM #4
works fine for me. I just tested it afew times.Code:XDOM.reload();
-
16 Jun 2009 6:29 AM #5
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.
-
17 Jun 2009 6:20 AM #6
I'd recommend looking into the GWT History class, and using that to maintain state...
-
17 Jun 2009 6:33 AM #7Sencha - Community Support Team
- Join Date
- Nov 2008
- Location
- San Diego, Peoples' Republic of California
- Posts
- 2,050
- Vote Rating
- 11
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:
Obviously do some logic to decide if you want to do the e.browserEvent.returnValue thing.Code:Ext.EventManager.on(window, 'beforeunload', function(e) { e.browserEvent.returnValue = 'You have unsaved changes... Press OK to quit anyway.'; });
-
17 Jun 2009 4:22 PM #8
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:
and then in my code I use this native method to set or clear the unload message as appropriate:Code:<script type="text/javascript" language="javascript"> var unloadMsg = ''; function handleBeforeUnload() { if (unloadMsg.length > 0) return unloadMsg; } window.onbeforeunload = handleBeforeUnload; </script>
Code:native private static void setUnloadMsg(String msg) /*-{ $wnd.unloadMsg = msg; }-*/;
-
18 Jun 2009 5:40 AM #9
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().
-
8 Apr 2010 3:06 AM #10
the page refresh when you click on F5
the page refresh when you click on F5
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.


Reply With Quote