This is a migrated thread and some comments may be shown as answers.

set_width problems in IE7

2 Answers 65 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 14 Sep 2009, 08:26 PM
I've run across a minor glitch with setting window height/width in ie7 and wondering if anyone can assist.

We have a ChangePage function that basically opens a new radwindow to a specified URL or changes the url of the radwindow that is currently open if one exists. I need the window to shrink to the 'aov' size if it comes from another location where the window is larger. This appears to work fine in FF and IE8, but in IE7 it is shrinking the height, but not the width. If I then click the refresh button on the radwindow, it will resize properly...but won't be centered.

function ChangePage(FileName, qty)  
   if (window.frameElement) { 
        // Redirect 
        GetRadWindow().SetUrl(FileName);     
         
        var curWidth = GetRadWindow().get_width(); 
        // Coming from Pers to AOV - shrink window 
        if (curWidth > 700 && FileName.indexOf("aov") > -1) { 
            GetRadWindow().set_width(645); 
            GetRadWindow().set_height(600); 
            GetRadWindow().center(); 
        } 
        // Coming from AOV to Pers - expand window 
        if (curWidth < 700 && FileName.indexOf("aov") == -1) { 
            GetRadWindow().set_width(1000); 
            GetRadWindow().set_height(850); 
            GetRadWindow().center(); 
        }            
    } else { 
        // Going to AOV or Pers check 
        if(FileName.indexOf("aov") > -1) { 
            openRadWindow(FileName,600,645,1,0,1,1,qty); 
        } else { 
            openRadWindow(FileName,850,1000,1,0,1,1,qty); 
        } 
    } 
 
 
function GetRadWindow()  
{     
    var oWindow = null
     if (window.radWindow) oWindow = window.radWindow;  
     else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;  
         
     oWindow.SetModal(true); 
     return oWindow; 
}  

2 Answers, 1 is accepted

Sort by
0
Nik
Top achievements
Rank 1
answered on 15 Sep 2009, 08:10 PM
I've also replicated this issue in ie6, The window resizes the height but not the width until I refresh the radwinow. It then resizes properly but does not center it on the screen. I've tried setSize instead of set_width and set_height. I've also tried autosize, but can't figure out how thats done in the JS. Also, we are using version 2008.1.515.20. Any help would be greatly appreciated!
0
Fiko
Telerik team
answered on 17 Sep 2009, 02:16 PM
Hi Nik,

In your case I have the following recommendations :
  • I recommend you update to a newer version - Q3 2008. This version is fully backward compatible with the version that you use. Please note that the newest one is Q2 2009, but in this release we made some changes in the internal CSS classes and you may have some problems if you use custom skins.
  • The RadWindow's get_width() and get_height() methods return the initial size of the window. For example : If you open a new RadWindow that have height = 200px, resize it to height = 500px and then call the get_height() it will return the 200, not 500. In your case you need to use the getWindowBounds instead
  • I recommend you call the show() function after setting the desired properties:
    function ChangePage(FileName, qty) 
        if (window.frameElement) 
        { 
            // Redirect  
            GetRadWindow().SetUrl(FileName); 
     
            var curWidth = GetRadWindow().get_width(); 
            // Coming from Pers to AOV - shrink window  
            if (curWidth > 700 && FileName.indexOf("aov") > -1) 
            { 
                GetRadWindow().set_width(645); 
                GetRadWindow().set_height(600); 
                GetRadWindow().center(); 
            } 
            // Coming from AOV to Pers - expand window  
            if (curWidth < 700 && FileName.indexOf("aov") == -1) 
            { 
                GetRadWindow().set_width(1000); 
                GetRadWindow().set_height(850); 
                GetRadWindow().center(); 
            } 
            GetRadWindow().show(); 
        } 
        else 
        { 
            // Going to AOV or Pers check  
            if (FileName.indexOf("aov") > -1) 
            { 
                openRadWindow(FileName, 600, 645, 1, 0, 1, 1, qty); 
            } else 
            { 
                openRadWindow(FileName, 850, 1000, 1, 0, 1, 1, qty); 
            } 
        } 
    }  

In case that the above suggestions did not help, please paste your full JavaScript code (openRadWindow() function's declaration) and I will do my best to provide a solution.

Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Window
Asked by
Nik
Top achievements
Rank 1
Answers by
Nik
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or