Difference between Ext.get() and Ext.getCmp():



Difference between Ext.get() and Ext.getCmp():

Ext.get( el ) :
  • This method retrieves Ext.dom.Element object which encapsulate DOM elements. This “get” is alias for Ext.dom.Element.get .
  • Parameters: It can be id of the node, a DOM Node or an existing Element.
    el : String/HTMLElement/Ext.Element
  • Returns: It returns Ext.dom.Element the Element object or null if no matching element was found.
Important: It returns the same element object due to simple caching on retrieving again. It means it returns wrong element on second time. Ext.fly() can be used for avoiding this problem.
Ext.getCmp( id ) :
  • This method retrieves a component not an element. This is shorthand reference to Ext.ComponentMgr.get .
  • Parameters: This is id of component.
    id : String
  • Returns: It returns a component object or undefined if not found, or null if a Class was found.

Comments

Popular Posts

Image