For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.ComponentManager

####

    HierarchyExt.AbstractManagerExt.ComponentManager

Provides a registry of all Components (instances of Ext.Component or any subclass thereof) on a page so that they can be easily accessed by component id (see get, or the convenience method Ext.getCmp).

This object also provides a registry of available Component classes indexed by a mnemonic code known as the Component's xtype. The `xtype` provides a way to avoid instantiating child Components when creating a full, nested config object for a complete Ext page.

A child Component may be specified simply as a config object as long as the correct `xtype` is specified so that if and when the Component needs rendering, the correct type can be looked up for lazy instantiation.

For a list of all available `xtypes`, see Ext.Component.

Defined By

### Properties

Ext.AbstractManager
view source
all : Ext.util.MixedCollection

Contains all of the items currently managed

Contains all of the items currently managed

Defined By

### Methods

Ext.ComponentManager
view source
create( Object config, Constructor defaultType) : Ext.Component
Creates a new Component from the specified config object using the config object's xtype to determine the class to in...

Creates a new Component from the specified config object using the config object's xtype to determine the class to instantiate.

### Parameters

- config : Object

  A configuration object for the Component you wish to create.

- defaultType : Constructor

  The constructor to provide the default Component type if the config object does not contain a `xtype`. (Optional if the config contains a `xtype`).

### Returns

- Ext.Component

  The newly instantiated Component.

Ext.AbstractManager
view source
each( Object fn, Object scope) : void
Executes the specified function once for each item in the collection. Returning false from the function will cease it...

Executes the specified function once for each item in the collection. Returning false from the function will cease iteration.

The paramaters passed to the function are:

- key : String

  The key of the item

- value : Number

  The value of the item

- length : Number

  The total number of items in the collection

### Parameters

- fn : Object

  The function to execute.

- scope : Object

  The scope to execute in. Defaults to `this`.

### Returns

- void

Ext.AbstractManager
view source
get( String id) : Mixed

Returns an item by id. For additional details see Ext.util.HashMap.get.

Returns an item by id. For additional details see Ext.util.HashMap.get.

### Parameters

- id : String

  The id of the item

### Returns

- Mixed

  The item, `undefined` if not found.

Ext.AbstractManager
view source
getCount : Number

Gets the number of items in the collection.

Gets the number of items in the collection.

### Returns

- Number

  The number of items in the collection.

Ext.AbstractManager
view source
isRegistered( String type) : Boolean

Checks if an item type is registered.

Checks if an item type is registered.

### Parameters

- type : String

  The mnemonic string by which the class may be looked up

### Returns

- Boolean

  Whether the type is registered.

Ext.AbstractManager
view source
onAvailable( String id, Function fn, Object scope) : void
Registers a function that will be called when an item with the specified id is added to the manager. This will happen...

Registers a function that will be called when an item with the specified id is added to the manager. This will happen on instantiation.

### Parameters

- id : String

  The item id

- fn : Function

  The callback function. Called with a single parameter, the item.

- scope : Object

  The scope (`this` reference) in which the callback is executed. Defaults to the item.

### Returns

- void

Ext.AbstractManager
view source
register( Mixed item) : void

Registers an item to be managed

Registers an item to be managed

### Parameters

- item : Mixed

  The item to register

### Returns

- void

Ext.AbstractManager
view source
registerType( String type, Constructor cls) : void

Registers a new item constructor, keyed by a type key.

Registers a new item constructor, keyed by a type key.

### Parameters

- type : String

  The mnemonic string by which the class may be looked up.

- cls : Constructor

  The new instance class.

### Returns

- void

Ext.AbstractManager
view source
unregister( Mixed item) : void

Unregisters an item by removing it from this manager

Unregisters an item by removing it from this manager

### Parameters

- item : Mixed

  The item to unregister

### Returns

- void