PDA

View Full Version : How obtain an ext js (4) Child component of the DOMWindow.



bryan10
30 Jan 2012, 9:54 AM
Hello,
I have created an Ext.Window containing a grid panel.
The grid panel has a selectionchange listener:
listeners: {
scope: this,
selectionchange: function(model, records, eOpts) {...}
}
Within the listener, 'this' is defined as DOMWindow.
I would like to obtain a reference to another component within the window
or within another container on the same page, without using Ext.getCmp.
Is there a way of obtaining an ext js child component of DOMWindow? e.g.
the opposite of findParentByType - when I try this.down(...), the following
error is obtained:
Uncaught TypeError: Object [object DOMWindow] has no method 'down'


p.s. In the example above I believe I could remove scope - however there have
been other circumstances where this = DOMWindow.


Thank you,
bryan.

josephkirubakaran
30 Jan 2012, 9:59 AM
Have you tried the following?
getChildByElement( Ext.Element/HTMLElement/String el )

friend
30 Jan 2012, 10:51 AM
Visit the API docs for Ext.ComponentQuery.query('someSelector'). This will allow you to get a reference to any component, from anywhere, based on the specified object/property selectors.

bryan10
30 Jan 2012, 11:00 AM
Hello,
Thank you for your reply.
Within the listener I tried:

var ele = this.getChildByElement('...');

and obtained the following error:

Uncaught TypeError: Object [object DOMWindow] has no method 'getChildByElement'

bryan10
31 Jan 2012, 11:17 PM
Apologies for the large font in the last reply - it wasn't intentional - post/reply can be deleted.

Tweak
1 Feb 2012, 4:31 AM
Hello Bryan,

Are you trying to get a component from the DOM window or from your Ext.window.Window?

For Ext.window.Window you could use the query() or the getChildByElement() methods.

Also, you set the scope to this, try setting the scope to your Window object.