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

Set KeepInScreenBounds in Javascript?

1 Answer 179 Views
Window
This is a migrated thread and some comments may be shown as answers.
John Cooney
Top achievements
Rank 1
John Cooney asked on 21 Mar 2011, 02:19 AM
I have some windows opening in one of my apps.  Everything works fine an then they want the window to present as longer than the screen which I have done but now I can not get the windows to open without going off the top of the screen.  How can I set a KeepInScreenBounds in this case?  These particular windows are called from javascript as follows:

function ShowLoc3Form(id, rowIndex, title, thiscase, thisorder, code)
{
    var txtbox = $find("RadTextBox1");  
    txtbox.set_value("");  
     
    var grid = $find("<%= RadGrid1.ClientID %>");
      
    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); 
    grid.get_masterTableView().selectItem(rowControl, true);
    var manager1 = GetRadWindow().get_windowManager();
    manager1.open("addlocation3.aspx?d=" + id + "&c=" + thiscase + "&o=" + thisorder + "&r=" + code + "&m=n", "RadWindow10");
    var window1 = manager1.getWindowByName("RadWindow10");
    window1.setSize(880,1000);  
    window1.set_modal(true);
    window1.set_title(title);
    window1.set_visibleStatusbar(false);
    return false
}

If I set the Radwindowmanager to keepinscreenbounds it seems to make no difference in this case.  When I open other windows server side this property seems to work fine.  Probably a simple question but I can't seem to get it to work.

Thanks,
JC

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Mar 2011, 09:15 AM
Hi John,

By default a modal RadWindow opens centered in the browser window and therefore if its height exceeds the browser's it is expected for it to go off the top of the screen. This also means that such height conflicts the KeepInScreenBounds directive and you are left with an incorrect scenario. To fix this you will have to move the window to the desired position manually. For your convenience I have included a simple JavaScript function in  my page. You can test it by removing the KeepInScreenBounds property from the declaration of the RadWindowManager.

That being said on my end the scenario works fine and the RadWindow is not shown outside of the browser window. I am attaching my test page and a video demonstrating my experiment. Am I missing something? Can you reproduce the issue on my page? Does it happen only under a certain browser? Are you using an older version of our controls with a newer browser?

Please make sure are using the correct references in your JavaScript and that your GetRadWindow() method returns a reference to the RadWindow you need (to get the correct RadWindowManager). You can use my page to see a more straightforward way of getting the references.



All the best,
Marin
the Telerik team
Tags
Window
Asked by
John Cooney
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or