View Full Version : Removing getCmp and replacing with alternative method

21 Feb 2011, 2:03 AM
I have been working on a project for about a couple of weeks now. It's almost all done but I am not liking the use of Ext.getCmp within it.

At the time I could not think of another way of referencing certain components. (Textfields, Grid etc)

What alternative methods are available to gain a reference to a component that isnt directly linked?

E.g. a gridpanel and a window

21 Feb 2011, 2:52 AM
Depends... if you're actually extending there is the ref property:


21 Feb 2011, 4:34 AM
Is the gridpanel inside the window? In that case you could indeed use 'ref' (or 'itemId').

If gridpanel and window are unrelated (e.g. window shows details for selected row) then the grid controller probably created the window, so it should keep a reference to it (the reverse is also possible).