PDA

View Full Version : [CLOSED] We are trying to call a javascript function in a parent window after this one opens a new child window.



romeu
Feb 14, 2012, 8:35 PM
We use ExtNet with Asp.Net MVC and we are trying to accomplish something that is really easy using regular javascript functions but we are not clear about how to do that using the ExtNet window.
We are trying to call a javascript function in a parent window after this one opens a new child window.

in the parent one we have a button:


<ext:Button ID="btnProcurar" runat="server" AutoWidth="false" Width="80px" Text="Search"
Icon="Find" StyleSpec="padding-top:2px;" OnClientClick="openWindow();" />

... and a function...


var openSearchWindow = function () {
// some code
var searchWindow = new Ext.IframeWindow({
id: 'searchWindow',
title: Search Lookup',
layout: 'fit',
autoScroll: true,
height: altura,
width: largura,
collapsible: true,
maximizable: true,
minimizable: true,
closeAction: "close",
icon: "Application",
modal: true,
dialog: true,
prompt : true,
src: '/one_url/',
MaskMsg: 'Loading...',
ShowMask: true
});

// some code
}

.. and another function...


var LocateRecord = function () {

}

the child one opens and now we need to call the "LocateRecord" function written in the parent.

In regular windows created with the usual "window.open" javascript function I just can access the function calling window.opener.LocateRecord()

How can I do the same with ExtNet?

regards,

geoffrey.mcgill
Feb 14, 2012, 9:02 PM
Hello,

From the child, you should be able to call parent.LocateRecord();

Example


parent.LocateRecord();

Hope this helps.

romeu
Feb 14, 2012, 10:22 PM
Thank you very much. It works now!

But now we have another problem.
The child window (search window) opens only inside the parent window (entry form window).

Our window hierarchy is: main window > entry form window > search window

The search window opens inside the entry form window, which is not so great because the search window is usually bigger than the entry form window.

So, we would like to open this window as a child of the main window. How can we do that?

regards

geoffrey.mcgill
Feb 14, 2012, 11:27 PM
For this to work, ideally the Window object needs to be instantiated and rendered to the parent frame. Components rendered to a child frame will be trapped inside that child frame.

romeu
Feb 15, 2012, 12:51 PM
thank's

When it releases version 2.0 of extnet ?

Daniil
Feb 15, 2012, 1:21 PM
The Ext.NET v2 beta release is imminent.

romeu
Feb 15, 2012, 5:15 PM
thank's.

no more questions


regards