1. #1
    Ext User
    Join Date
    Feb 2009
    Posts
    25
    Vote Rating
    0
    rakir is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha Premium Member
    Join Date
    Dec 2008
    Location
    Munich, Germany
    Posts
    183
    Vote Rating
    0
    Jose Jeria is an unknown quantity at this point

      0  

    Default


    I found this solution using Google.


  3. #3
    Ext GWT Premium Member
    Join Date
    Apr 2009
    Posts
    25
    Vote Rating
    3
    Miggins is on a distinguished road

      0  

    Default


    You can also use:

    Code:
    Window.Location.reload();

  4. #4
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
    XDOM.reload();
    works fine for me. I just tested it afew times.

  5. #5
    Sencha User
    Join Date
    Nov 2007
    Posts
    20
    Vote Rating
    0
    gaspo100 is on a distinguished road

      0  

    Default


    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.

  6. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    I'd recommend looking into the GWT History class, and using that to maintain state...

  7. #7
    Sencha - Community Support Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,053
    Vote Rating
    17
    mschwartz will become famous soon enough mschwartz will become famous soon enough

      0  

    Default


    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:
    Code:
            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.

  8. #8
    Sencha User
    Join Date
    Nov 2007
    Posts
    20
    Vote Rating
    0
    gaspo100 is on a distinguished road

      0  

    Default


    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:
    Code:
     <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:
    Code:
    native private static void setUnloadMsg(String msg) /*-{ $wnd.unloadMsg = msg; }-*/;

  9. #9
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    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().

  10. #10
    Ext User
    Join Date
    Apr 2010
    Posts
    2
    Vote Rating
    0
    sami_sahli is on a distinguished road

      0  

    Default 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.