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

find multiple windows

2 Answers 89 Views
Window
This is a migrated thread and some comments may be shown as answers.
mabs
Top achievements
Rank 1
mabs asked on 01 Oct 2010, 03:42 PM
I have a page where It is possible to luanceh more than one radwindow, I am creating these windows in the following way,
var popup = window.radopen(Url, null);
The user can click a button which will open window 'a', they can then do something else that will cause window 'b' to open.  When in window 'b' I would like to get hold of window 'a' to refresh the content.  I would guess a way to find this is to find the window which is not selected, which would be window 'a'.  I have no idea on how to do this, I can only seem to get hold of the current window when using GetRadWindow()
function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}
Any suggestions would be much appreciated.

2 Answers, 1 is accepted

Sort by
0
mabs
Top achievements
Rank 1
answered on 01 Oct 2010, 05:50 PM
sorted, record the windows id's on creation, then you can reference them.
0
Georgi Tunev
Telerik team
answered on 04 Oct 2010, 10:59 AM
Hi Russell,

Basically, you could use the get_windows() method of the RadWindowManager to get a reference to a specific RadWindow. For example, the code bellow will close all RadWindows on the page, except the active one:

<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
<script type="text/javascript">
    function closeAllButActive()
    {
        var windowManager = GetRadWindowManager();
        var allWindows = windowManager.get_windows();
 
 
        for (var i = 0; i < allWindows.length; i++)
        {
            var currentWindow = allWindows[i];
            if (!currentWindow.isActive())
            {
                currentWindow.close();
            }
        }
    }
 
    function openWin()
    {
        radopen("http://google.com", null);
    }
</script>
<button onclick="openWin(); return false;">
    open RadWindows</button>
<button onclick="closeAllButActive(); return false;">
    Close all but the active RadWindow</button>
</form>
</body>
</html>

Note that the closeAllButActive() function should be in the parent page, where the RadWindowManager is.

Kind regards,
Georgi Tunev
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
Tags
Window
Asked by
mabs
Top achievements
Rank 1
Answers by
mabs
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or