View Full Version : How can I find closest Component object from a DOM element?

23 Apr 2013, 6:04 AM
Given a DOM element, is there a Sencha method that will walk up from the DOM element and find the first Component object?

For example, if a component's associated DOM representation is <div><span id="xyz">dfsdf</span>...</div>" and I have a DOM reference to the span object, how can I look up the associated component object?

24 Apr 2013, 1:06 AM
I think you can use 'Ext.get(element' for this.


If this is not adequate maybe explain the full problem for a better solution.

25 Apr 2013, 12:29 AM
I think the guy wants to get the closest Ext.Component (of sub classes). not the dom element. maybe use Ext.getCmp(el.id)

3 Jun 2014, 2:17 AM
I have the following

click: function (e,element,event) {
console.info(element); //<textarea id=?"textarea-1091-inputEl" role=?"textbox" name=?"p_php_list_criteria" rows=?"4" cols=?"20" class=?"x-form-field x-form-text x-form-textarea x-form-focus x-field-form-focus x-field-default-form-focus" autocomplete=?"off" style=?"width:? 100%;?">?</textarea>?


My question is how would one get the closest valid Sencha Component from the item clicked on, using the element attribute?

Thanks in advance.

5 Jun 2015, 12:48 AM
if you have the HTML element , you can get its Id using element.Id and then use EXT.getCmp() to get the sencha object of that element