I\'m very confused which one I need to use for grep object between up() down() and Ext.getCmp(ID).
For me, it is easier that define ID to object and retrieve the obj
Ext.getCmp()
uses a hash map internally, so it is lighting fast, nearly as fast as retrieving the value in an array based on a key.
.up()
and down()
are implemented using a traversal of the component hierarchy, which is a slower process.
But up()
and down()
use selectors, so they can also select classes, not just ids.
You just need to remember that are various situations where you might want to use up()
or down()
, like when there's a common handler for a multitude of controls, or when the component you're after was auto-generated by the framework so you cannot give it an id yourself.