Ext.data.JsonP.Ext_ModelManager({"mixins":[],"code_type":"ext_define","inheritable":false,"component":false,"meta":{"author":["Ed Spencer"],"markdown":true},"mixedInto":[],"uses":[],"aliases":{},"parentMixins":[],"superclasses":["Ext.Base","Ext.AbstractManager"],"members":{"event":[],"property":[{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"$className","id":"property-S-className"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"property","name":"all","id":"property-all"},{"meta":{},"owner":"Ext.ModelManager","tagname":"property","name":"associationStack","id":"property-associationStack"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"configMap","id":"property-configMap"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"initConfigList","id":"property-initConfigList"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"initConfigMap","id":"property-initConfigMap"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"isInstance","id":"property-isInstance"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"property","name":"self","id":"property-self"}],"css_var":[],"method":[{"meta":{"deprecated":{"text":"as of 4.1. Use {@link #callParent} instead."},"protected":true},"owner":"Ext.Base","tagname":"method","name":"callOverridden","id":"method-callOverridden"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"callParent","id":"method-callParent"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"configClass","id":"method-configClass"},{"meta":{"deprecated":{"text":"Use {@link Ext#create Ext.create} instead.","version":"4.1"}},"owner":"Ext.ModelManager","tagname":"method","name":"create","id":"method-create"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"destroy","id":"method-destroy"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"each","id":"method-each"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"get","id":"method-get"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"getConfig","id":"method-getConfig"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"getCount","id":"method-getCount"},{"meta":{},"owner":"Ext.Base","tagname":"method","name":"getInitialConfig","id":"method-getInitialConfig"},{"meta":{},"owner":"Ext.ModelManager","tagname":"method","name":"getModel","id":"method-getModel"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"hasConfig","id":"method-hasConfig"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"initConfig","id":"method-initConfig"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"isRegistered","id":"method-isRegistered"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"onAvailable","id":"method-onAvailable"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"onConfigUpdate","id":"method-onConfigUpdate"},{"meta":{"private":true},"owner":"Ext.ModelManager","tagname":"method","name":"onModelDefined","id":"method-onModelDefined"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"register","id":"method-register"},{"meta":{"private":true},"owner":"Ext.ModelManager","tagname":"method","name":"registerDeferredAssociation","id":"method-registerDeferredAssociation"},{"meta":{"private":true},"owner":"Ext.ModelManager","tagname":"method","name":"registerType","id":"method-registerType"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"setConfig","id":"method-setConfig"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"statics","id":"method-statics"},{"meta":{},"owner":"Ext.AbstractManager","tagname":"method","name":"unregister","id":"method-unregister"}],"css_mixin":[],"cfg":[]},"tagname":"class","extends":"Ext.AbstractManager","html":"

Alternate names

Ext.ModelMgr

Hierarchy

Requires

Files

The ModelManager keeps track of all Ext.data.Model types defined in your application.

\n\n

Creating Model Instances

\n\n

Model instances can be created by using the Ext.create method. Ext.create replaces\nthe deprecated Ext.ModelManager.create method. It is also possible to create a model instance\nthis by using the Model type directly. The following 3 snippets are equivalent:

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: ['first', 'last']\n});\n\n// method 1, create using Ext.create (recommended)\nExt.create('User', {\n    first: 'Ed',\n    last: 'Spencer'\n});\n\n// method 2, create through the manager (deprecated)\nExt.ModelManager.create({\n    first: 'Ed',\n    last: 'Spencer'\n}, 'User');\n\n// method 3, create on the type directly\nnew User({\n    first: 'Ed',\n    last: 'Spencer'\n});\n
\n\n

Accessing Model Types

\n\n

A reference to a Model type can be obtained by using the getModel function. Since models types\nare normal classes, you can access the type directly. The following snippets are equivalent:

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: ['first', 'last']\n});\n\n// method 1, access model type through the manager\nvar UserType = Ext.ModelManager.getModel('User');\n\n// method 2, reference the type directly\nvar UserType = User;\n
\n
Defined By

Properties

...
\n

Defaults to: "Ext.Base"

Contains all of the items currently managed

\n

Contains all of the items currently managed

\n
Private stack of associations that must be created once their associated model has been defined ...

Private stack of associations that must be created once their associated model has been defined

\n

Defaults to: []

...
\n

Defaults to: {}

...
\n

Defaults to: []

...
\n

Defaults to: {}

...
\n

Defaults to: true

Get the reference to the current class from which this object was instantiated. ...

Get the reference to the current class from which this object was instantiated. Unlike statics,\nthis.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics\nfor a detailed comparison

\n\n
Ext.define('My.Cat', {\n    statics: {\n        speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n    },\n\n    constructor: function() {\n        alert(this.self.speciesName); // dependent on 'this'\n    },\n\n    clone: function() {\n        return new this.self();\n    }\n});\n\n\nExt.define('My.SnowLeopard', {\n    extend: 'My.Cat',\n    statics: {\n        speciesName: 'Snow Leopard'         // My.SnowLeopard.speciesName = 'Snow Leopard'\n    }\n});\n\nvar cat = new My.Cat();                     // alerts 'Cat'\nvar snowLeopard = new My.SnowLeopard();     // alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone));             // alerts 'My.SnowLeopard'\n
\n
Defined By

Methods

( Array/Arguments args ) : Objectdeprecatedprotected
Call the original method that was previously overridden with override\n\nExt.define('My.Cat', {\n constructor: functi...

Call the original method that was previously overridden with override

\n\n
Ext.define('My.Cat', {\n    constructor: function() {\n        alert(\"I'm a cat!\");\n    }\n});\n\nMy.Cat.override({\n    constructor: function() {\n        alert(\"I'm going to be a cat!\");\n\n        this.callOverridden();\n\n        alert(\"Meeeeoooowwww\");\n    }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n                          // alerts \"I'm a cat!\"\n                          // alerts \"Meeeeoooowwww\"\n
\n
\n

This method has been deprecated

\n

as of 4.1. Use callParent instead.

\n\n
\n

Parameters

  • args : Array/Arguments

    The arguments, either an array or the arguments object\nfrom the current method, for example: this.callOverridden(arguments)

    \n

Returns

  • Object

    Returns the result of calling the overridden method

    \n
( Array/Arguments args ) : Objectprotected
Call the \"parent\" method of the current method. ...

Call the \"parent\" method of the current method. That is the method previously\noverridden by derivation or by an override (see Ext.define).

\n\n
 Ext.define('My.Base', {\n     constructor: function (x) {\n         this.x = x;\n     },\n\n     statics: {\n         method: function (x) {\n             return x;\n         }\n     }\n });\n\n Ext.define('My.Derived', {\n     extend: 'My.Base',\n\n     constructor: function () {\n         this.callParent([21]);\n     }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x);  // alerts 21\n
\n\n

This can be used with an override as follows:

\n\n
 Ext.define('My.DerivedOverride', {\n     override: 'My.Derived',\n\n     constructor: function (x) {\n         this.callParent([x*2]); // calls original My.Derived constructor\n     }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x);  // now alerts 42\n
\n\n

This also works with static methods.

\n\n
 Ext.define('My.Derived2', {\n     extend: 'My.Base',\n\n     statics: {\n         method: function (x) {\n             return this.callParent([x*2]); // calls My.Base.method\n         }\n     }\n });\n\n alert(My.Base.method(10);     // alerts 10\n alert(My.Derived2.method(10); // alerts 20\n
\n\n

Lastly, it also works with overridden static methods.

\n\n
 Ext.define('My.Derived2Override', {\n     override: 'My.Derived2',\n\n     statics: {\n         method: function (x) {\n             return this.callParent([x*2]); // calls My.Derived2.method\n         }\n     }\n });\n\n alert(My.Derived2.method(10); // now alerts 40\n
\n

Parameters

  • args : Array/Arguments

    The arguments, either an array or the arguments object\nfrom the current method, for example: this.callParent(arguments)

    \n

Returns

  • Object

    Returns the result of calling the parent method

    \n
Ext.ModelManager
view source
( Object data, String name, [Number id] )deprecated
Creates a new instance of a Model using the given data. ...

Creates a new instance of a Model using the given data. Deprecated, instead use Ext.create:

\n\n
Ext.create('User', {\n    first: 'Ed',\n    last: 'Spencer'\n});\n
\n
\n

This method has been deprecated since 4.1

\n

Use Ext.create instead.

\n\n
\n

Parameters

  • data : Object

    Data to initialize the Model's fields with

    \n
  • name : String

    The name of the model to create

    \n
  • id : Number (optional)

    unique id of the Model instance (see Ext.data.Model)

    \n

Overrides: Ext.AbstractManager.create

Executes the specified function once for each item in the collection. ...

Executes the specified function once for each item in the collection.

\n

Parameters

  • fn : Function

    The function to execute.

    \n

    Parameters

    • key : String

      The key of the item

      \n
    • value : Number

      The value of the item

      \n
    • length : Number

      The total number of items in the collection

      \n

    Returns

  • scope : Object

    The scope to execute in. Defaults to this.

    \n
Returns an item by id. ...

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

\n

Parameters

  • id : String

    The id of the item

    \n

Returns

  • Object

    The item, undefined if not found.

    \n
...
\n

Parameters

Gets the number of items in the collection. ...

Gets the number of items in the collection.

\n

Returns

  • Number

    The number of items in the collection.

    \n
Returns the initial configuration passed to constructor when instantiating\nthis class. ...

Returns the initial configuration passed to constructor when instantiating\nthis class.

\n

Parameters

  • name : String (optional)

    Name of the config option to return.

    \n

Returns

  • Object/Mixed

    The full config object or a single config value\nwhen name parameter specified.

    \n
Returns the Ext.data.Model for a given model name ...

Returns the Ext.data.Model for a given model name

\n

Parameters

  • id : String/Object

    The id of the model or the model instance.

    \n

Returns

...
\n

Parameters

Initialize configuration for this class. ...

Initialize configuration for this class. a typical example:

\n\n
Ext.define('My.awesome.Class', {\n    // The default config\n    config: {\n        name: 'Awesome',\n        isAwesome: true\n    },\n\n    constructor: function(config) {\n        this.initConfig(config);\n    }\n});\n\nvar awesome = new My.awesome.Class({\n    name: 'Super Awesome'\n});\n\nalert(awesome.getName()); // 'Super Awesome'\n
\n

Parameters

Returns

Checks if an item type is registered. ...

Checks if an item type is registered.

\n

Parameters

  • type : String

    The mnemonic string by which the class may be looked up

    \n

Returns

  • Boolean

    Whether the type is registered.

    \n
Registers a function that will be called when an item with the specified id is added to the manager. ...

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

\n

Parameters

  • id : String

    The item id

    \n
  • fn : Function

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

    \n
  • scope : Object

    The scope (this reference) in which the callback is executed.\nDefaults to the item.

    \n
( Object names, Object callback, Object scope )private
...
\n

Parameters

Ext.ModelManager
view source
( Function model )private
Private callback called whenever a model has just been defined. ...

Private callback called whenever a model has just been defined. This sets up any associations\nthat were waiting for the given model to be defined

\n

Parameters

  • model : Function

    The model that was just created

    \n
Registers an item to be managed ...

Registers an item to be managed

\n

Parameters

  • item : Object

    The item to register

    \n
Registers an association where one of the models defined doesn't exist yet. ...

Registers an association where one of the models defined doesn't exist yet.\nThe ModelManager will check when new models are registered if it can link them\ntogether

\n

Parameters

Ext.ModelManager
view source
( Object name, Object config )private
Registers a model definition. ...

Registers a model definition. All model plugins marked with isDefault: true are bootstrapped\nimmediately, as are any addition plugins defined in the model config.

\n

Parameters

Overrides: Ext.AbstractManager.registerType

( Object config, Object applyIfNotSet )private
...
\n

Parameters

Get the reference to the class from which this object was instantiated. ...

Get the reference to the class from which this object was instantiated. Note that unlike self,\nthis.statics() is scope-independent and it always returns the class from which it was called, regardless of what\nthis points to during run-time

\n\n
Ext.define('My.Cat', {\n    statics: {\n        totalCreated: 0,\n        speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n    },\n\n    constructor: function() {\n        var statics = this.statics();\n\n        alert(statics.speciesName);     // always equals to 'Cat' no matter what 'this' refers to\n                                        // equivalent to: My.Cat.speciesName\n\n        alert(this.self.speciesName);   // dependent on 'this'\n\n        statics.totalCreated++;\n    },\n\n    clone: function() {\n        var cloned = new this.self;                      // dependent on 'this'\n\n        cloned.groupName = this.statics().speciesName;   // equivalent to: My.Cat.speciesName\n\n        return cloned;\n    }\n});\n\n\nExt.define('My.SnowLeopard', {\n    extend: 'My.Cat',\n\n    statics: {\n        speciesName: 'Snow Leopard'     // My.SnowLeopard.speciesName = 'Snow Leopard'\n    },\n\n    constructor: function() {\n        this.callParent();\n    }\n});\n\nvar cat = new My.Cat();                 // alerts 'Cat', then alerts 'Cat'\n\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone));         // alerts 'My.SnowLeopard'\nalert(clone.groupName);                 // alerts 'Cat'\n\nalert(My.Cat.totalCreated);             // alerts 3\n
\n

Returns

Unregisters an item by removing it from this manager ...

Unregisters an item by removing it from this manager

\n

Parameters

  • item : Object

    The item to unregister

    \n
","subclasses":[],"name":"Ext.ModelManager","alternateClassNames":["Ext.ModelMgr"],"inheritdoc":null,"files":[{"href":"ModelManager.html#Ext-ModelManager","filename":"ModelManager.js"}],"html_meta":{"author":null,"markdown":null},"singleton":true,"id":"class-Ext.ModelManager","statics":{"property":[],"event":[],"css_var":[],"method":[],"css_mixin":[],"cfg":[]},"requires":["Ext.data.association.Association"]});