Maximized-mode window not resizes when browser resizes

5 posts, 0 answers
  1. Channa Leang
    Channa Leang avatar
    19 posts
    Member since:
    May 2009

    Posted 24 May 2010 Link to this post

    I'm in the middle of upgrading process from RadControls ASP.NET Q2 2007 to Asp.Net Ajax Q1 2010. One of my issues I'm facing now is, my popup radwindow in maximized mode doesn't resize when I resize the browser in Q1 2010. It's working though in my old Q2 07.

    Here is the code in Q2 07,

    <radW:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="False" ShowContentDuringLoad="False" runat="server" Left="" SkinsPath="~/RadControls/Window/Skins" Title="" Top="">
            <Windows>
                <radW:RadWindow ID="winEdit" SkinsPath="~/RadControls/Window/Skins/Default" Modal="True" Height="600px" Width="1000px" VisibleStatusbar="False" runat="server" Title="Loading..." />
            </Windows>
        </radW:RadWindowManager>


    in Q1 2010,

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="winEdit" runat="server" InitialBehaviors="Maximize" KeepInScreenBounds="true" Behaviors="Reload,Minimize,Maximize,Resize,Close" Modal="true" VisibleStatusbar="false" ShowContentDuringLoad="false" ReloadOnShow="true" Title="Loading..." Skin="WebBlue" />
        </Windows>
    </telerik:RadWindowManager>


    and both have the same javascript function to pop the window,

    <script type="text/javascript">
    function ShowWindow( url,winId ) {
        var x = window.radopen(url, winId);
        x.Maximize(); 
        return false;
    }
    </script>

    Help!
  2. Channa Leang
    Channa Leang avatar
    19 posts
    Member since:
    May 2009

    Posted 25 May 2010 Link to this post

    Here is my work around on this issue,

    $(document).ready(function() {
            $(window).bind('resize', function() {
                var oManager = GetRadWindowManager();
                if (typeof oManager == 'undefined') {
                    return false;
                } else {
                    var oWnd = oManager.getWindowByName("winEdit");
                    if (oWnd != null) oWnd.maximize();
                }
            });
        });


    Let me know if you have a better solution.
  3. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 26 May 2010 Link to this post

    Hello Channa,

    The problem itself is related to the "em" element which is in the titlebar. Its width is calculated via JavaScript and if you try to resize the browser to smaller width - it will not resize the window to smaller width. We know about this problem and we will do our best to fix it for one of our future releases.
    I created a workaround which overrides the _maintainMaximizedSize method.
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <script type="text/javascript">
            function ShowWindow( url,winId ) {
                var x = window.radopen(url, winId);
                return false;
            }
      
            Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSizeOld = Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSize;
            Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSize = function ()
            {
      
                var titleElem = this._getTitleElement();
                if (titleElem)
                {
                    titleElem.style.display = "none";
                    this._updateTitleWidth();
                }
      
                this._maintainMaximizedSizeOld();
                if (titleElem)
                {
                    titleElem.style.display = "";
                }
            }
      
              
        </script>
        <div>
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                <Windows>
                    <telerik:RadWindow ID="winEdit" runat="server" InitialBehaviors="Maximize" 
                        KeepInScreenBounds="true"
                        Behaviors="Reload,Minimize,Maximize,Resize,Close" Modal="true" VisibleStatusbar="false"
                        ShowContentDuringLoad="false" ReloadOnShow="true" Title="Loading..." Skin="WebBlue" />
                </Windows>
            </telerik:RadWindowManager>
            <input type="button" value="open window" onclick="ShowWindow('http://www.google.com','winEdit')"/>
        </div>
        </form>
    </body>
    </html>

    Hope this helps.

    Kind regards,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. Channa Leang
    Channa Leang avatar
    19 posts
    Member since:
    May 2009

    Posted 26 May 2010 Link to this post

    Thanks Petio. After applying your code, it seems working in IE, but not in Firefox (run on v3.6.3) :-(
  5. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 27 May 2010 Link to this post

    Hello,

    I tested the page I sent to you under FF(version 3.6.3) and it works. When I resize the browser - the maximized RadWindow is resized too.
    Could you please try to delete the browser cache and check it again?  Also you can add an alert in the code to check whether it is executed or not, e.g.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <head id="Head1" runat="server"
        <title></title
    </head
    <body
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager
        <script type="text/javascript">
            function ShowWindow(url, winId)
            {
                var x = window.radopen(url, winId);
                return false;
            }
      
            Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSizeOld = Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSize;
            Telerik.Web.UI.RadWindow.prototype._maintainMaximizedSize = function ()
            {
                alert(1);
                var titleElem = this._getTitleElement();
                if (titleElem)
                {
                    titleElem.style.display = "none";
                    this._updateTitleWidth();
                }
      
                this._maintainMaximizedSizeOld();
                if (titleElem)
                {
                    titleElem.style.display = "";
                }
            
        </script
        <div
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
                <Windows
                    <telerik:RadWindow ID="winEdit" runat="server" InitialBehaviors="Maximize" 
                        KeepInScreenBounds="true"
                        Behaviors="Reload,Minimize,Maximize,Resize,Close" Modal="true" VisibleStatusbar="false"
                        ShowContentDuringLoad="false" ReloadOnShow="true" Title="Loading..." Skin="WebBlue" /> 
                </Windows
            </telerik:RadWindowManager
            <input type="button" value="open window" onclick="ShowWindow('http://www.google.com','winEdit')"/> 
        </div
        </form
    </body
    </html>

    Looking forward for your reply.

    Greetings,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top