Refreshing parent window from modal window?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gsuns82
    New Member
    • Mar 2007
    • 58

    Refreshing parent window from modal window?

    Hi all,
    I am using modal window for some update purpose,
    the issue i am facing is,i am not able to refresh parent after closing
    modal window.

    The code i used:
    ------------------------

    For opening modal window from parent window:
    Code:
    showModalDialog("mypage.jsp",window,"dialogHeight:480px;dialogWidth:700px;");
    For closing modal and refreshing parent the following code is used:

    Code:
            window.close();
            var xWin = window.dialogArguments;
    	xWin.location.reload(true);
    The above code is inconsistent in refreshing parent,if i refresh parent for more than 2 or 3 times its not showing the latest value instead it shows the value from browser cache,

    i am also using the following code in parent page to avoid cache store

    [HTML]<meta http-equiv="cache-control" content="text/html; charset=iso-8859-1, no-cache, no-store, must-revalidate" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="pragma" content="no-cache" />
    [/HTML]
    can any one tell me how to over come this issue?

    regards,
    sundar
    Last edited by acoder; Oct 30 '08, 08:01 AM. Reason: Added [code] tags
  • Rsmastermind
    New Member
    • Sep 2008
    • 93

    #2
    Hi friend
    can you please tell me what is gettijng done by window.dialogAr gument.

    As I can see in the above line you have close the Modal window and then tried to refresh the parent page.Which is not true.As as soon the Modal window is closed the function can not trace th parent of this window.

    Now do one thing instead of closing at the first close it in the last of the code
    and it is always safe to use top.close instead of window.close.

    Hope this will resolve your problem.

    Comment

    • gsuns82
      New Member
      • Mar 2007
      • 58

      #3
      Originally posted by Rsmastermind
      Hi friend
      can you please tell me what is gettijng done by window.dialogAr gument.

      As I can see in the above line you have close the Modal window and then tried to refresh the parent page.Which is not true.As as soon the Modal window is closed the function can not trace th parent of this window.

      Now do one thing instead of closing at the first close it in the last of the code
      and it is always safe to use top.close instead of window.close.

      Hope this will resolve your problem.
      Hi friend,
      window.dialogAr gument returns the reference of parent window,
      the problem i face is parent window gets refreshed before the server side code gets executed,so the latest value is not reflected when i use javascript parent window refresh.....


      how to fix this?


      regards,
      sundar

      Comment

      • Rsmastermind
        New Member
        • Sep 2008
        • 93

        #4
        I had mentioned solution to this problem in the previous post.Please read that carefully.You are refreshing the parent later and closing the modal first .Do the reverse of it.First refresh the parent then at last write top.close this will work fine.

        Comment

        Working...