PDA

View Full Version : Identify the immediate component a dom element is in



ritcoder
18 Feb 2012, 10:55 AM
Hi all,
Given an element eg pre, div, etc,
how do I get the Ext.Component that contains that element?

For if I have a panel with html in it and the html has a pre and I have a handle to the pre element, how do I get the panel back? This is not only for the panel but for the immediate container of the element.

regards.

mitchellsimoens
19 Feb 2012, 6:43 AM
Depends what you are doing. If you have a listener on some element then I would use the scope option and specify the component that element is in as the scope. Past that, you would have the fragile way of walking up the DOM until you got to the outer most element and the id on the outer most element of a component is the same id the component has.