PDA

View Full Version : Different ways to get to an Ext DOM element



anilgs
20 Apr 2012, 7:35 PM
I have access to a target HTML Image object in an event handler. I know the parent to this target object is a DIV.

To access the DIV element, I have used couple of methods -
var div = target.parent() and
var div = Ext.fly("summary"+target.getId())

The former div object works first time, but if I were to reuse it, it starts failing.
The latter always works when I call div.addCls('selected')

Also noticed that the first object have isSynchronized set to true and the latter has it set to false.
Can someone please explain ?

scottmartin
23 Apr 2012, 12:51 PM
Have you tried Ext.get()?


Regards,
Scott.

anilgs
23 Apr 2012, 10:11 PM
I believe Ext.get() is similar to Ext.fly() except that it looks up in the cache.
My question was mostly about why target.parent() is not reliable.
Ext.fly() works for me always, which is what I ended up using.