Results 1 to 1 of 1

Thread: Quick and universal way to find the containing window of a widget

  1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    534

    Default Quick and universal way to find the containing window of a widget

    I've been trying to figure out a clean and consistent way to determine the parent window of a widget (i.e., a button, menu, or other UI widget that's contained within an Ext window panel). I have the following code that works (although maybe there's a more elegant way) when I have an event object available (where 'e' is the event object):

    PHP Code:
    Ext.getCmp(Ext.get(e.getTarget('div.x-window')).id); 
    But this approach doesn't work for a menu, for example (as there is no getTarget function).

    I tried this too, and got a null result:

    PHP Code:
    Ext.getCmp(m.getEl().findParent('div.x-window').id
    Any ideas would be greatly appreciated. And ideally, I'd like the solution to work for any Ext element

    I also tried this, but also get a null result (and discovered that a menu item added to a toolbar button has no ownerCt property--is that a bug?):

    PHP Code:
    m.findParentByType(Ext.Window
    Tnx!
    Eric
    Last edited by Eric24; 27 Sep 2009 at 8:29 PM. Reason: More research...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •