PDA

View Full Version : Accessing a parent method from a child window



Rammynampati
7 Aug 2009, 11:47 AM
Community,
Sorry to open another thread on this. I have gone through most of the threads on this topic and came across solutions like Iframe,ownerCt,getParentByType,getEl,window.parent....many .But nothing working .

My simple question is "How to get the parent class methods from a child ". In my case both parent and child are windows. Please any one can help me.

Animal
7 Aug 2009, 1:18 PM
"both parent and child are windows"

Not possible.

Show code and explain better.

Rammynampati
7 Aug 2009, 11:11 PM
Hi Animal,
Thanks for your reply. I attached the two windows i am using. From searchEmployee .js i need to call AddNewQuota (I need to call the parent15505). Please provide me some help. Thanks in advance.

Animal
7 Aug 2009, 11:29 PM
Your code is disastrous.

Panels in Panels Panels in Panels Panels in Panels Panels in Panels Panels...

But Windows do not have Windows as child items.

Rammynampati
8 Aug 2009, 9:06 AM
HI, Yes I am using panels in windows. i am capable of calling the parent window with it's id from child window as "getCmp()" Ext.getCmp('some id').method of that window. Its working great. But my only concern is to get it in generic way so that i can call the parent with out recognizing by id. I mean the immediate parent (whatever it is) and access its method. Do you think what i am doing is totally crap like. Do i need to change in layout. please provide me some idea.

Rammynampati
8 Aug 2009, 9:11 AM
Hi i want some thing like opener.window like functionality to call a parent window

Animal
8 Aug 2009, 2:03 PM
There is no concept of parent Window.

Rammynampati
8 Aug 2009, 9:18 PM
So, How can i achieve this..is it can't possible.

Animal
8 Aug 2009, 11:06 PM
I am not going through all your code.

You need to explain what application problem you are trying to solve, and maybe someone can recommend a design solution.

Rammynampati
8 Aug 2009, 11:16 PM
Hi Animal,
That's a great response from you. I really very much thankful for this. As i already wrote in previous replies and messages, i am using two Js files with two windows. i am using FormPanel in that i am using panels to create textfields and button opposite to a textfield which on click opens a new window. In this new window i search for an employee data and get it as grid view and when i choose a checkbox and do select i get that "employeeId" into the parent window textfield.
This is the functionality i need to achieve. Actually today i am from home so i can send you the screen shots tomorrow from office.

Animal
8 Aug 2009, 11:45 PM
You need to inject a reference to the "parent" Window when you create the new Window if methods in that new Window need to refer to it.

Animal
8 Aug 2009, 11:45 PM
This seems like basic Javascript programming advice, not an ExtJs query.

Rammynampati
11 Aug 2009, 4:24 AM
Hi All,
This thread is closed.Thanks for all for their help.