Results 1 to 2 of 2

Thread: get nearest enclosing component of a raw DOM element

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    13

    Default Answered: get nearest enclosing component of a raw DOM element

    I have a reference to the DOM element that was created inside a component that is capable of rendering arbitrary HTML. How do I get the component containing this element?

    Code:
    function findComponentByChild(rawElem) {
      var foundCmp;
      Ext.fly(rawElem).findParent(function(x) { return (foundCmp = Ext.getCmp(x.id)) !== undefined; });
      return foundCmp;
    }
    The problem with the code above is that passing a function instead of an expression to findParent() is not documented.


  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

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