Clear Up
SharpKit Reference

ModelManager Class

Namespace: Ext

Base Types

System.Object

Constructors

Name Description
ModelManager()

Properties

Name Description
alternateClassName @author Ed Spencer @class Ext.ModelManager @extends Ext.AbstractManager The ModelManager keeps track of all {@link Ext.data.Model} types defined in your application. __Creating Model Instances__ Model instances can be created by using the {@link Ext#create Ext.create} method. Ext.create replaces the deprecated {@link #create Ext.ModelManager.create} method. It is also possible to create a model instance this by using the Model type directly. The following 3 snippets are equivalent: Ext.define('User', { extend: 'Ext.data.Model', fields: ['first', 'last'] }); // method 1, create using Ext.create (recommended) Ext.create('User', { first: 'Ed', last: 'Spencer' }); // method 2, create through the manager (deprecated) Ext.ModelManager.create({ first: 'Ed', last: 'Spencer' }, 'User'); // method 3, create on the type directly new User({ first: 'Ed', last: 'Spencer' }); __Accessing Model Types__ A reference to a Model type can be obtained by using the {@link #getModel} function. Since models types are normal classes, you can access the type directly. The following snippets are equivalent: Ext.define('User', { extend: 'Ext.data.Model', fields: ['first', 'last'] }); // method 1, access model type through the manager var UserType = Ext.ModelManager.getModel('User'); // method 2, reference the type directly var UserType = User; @markdown @singleton
extend @author Ed Spencer @class Ext.ModelManager @extends Ext.AbstractManager The ModelManager keeps track of all {@link Ext.data.Model} types defined in your application. __Creating Model Instances__ Model instances can be created by using the {@link Ext#create Ext.create} method. Ext.create replaces the deprecated {@link #create Ext.ModelManager.create} method. It is also possible to create a model instance this by using the Model type directly. The following 3 snippets are equivalent: Ext.define('User', { extend: 'Ext.data.Model', fields: ['first', 'last'] }); // method 1, create using Ext.create (recommended) Ext.create('User', { first: 'Ed', last: 'Spencer' }); // method 2, create through the manager (deprecated) Ext.ModelManager.create({ first: 'Ed', last: 'Spencer' }, 'User'); // method 3, create on the type directly new User({ first: 'Ed', last: 'Spencer' }); __Accessing Model Types__ A reference to a Model type can be obtained by using the {@link #getModel} function. Since models types are normal classes, you can access the type directly. The following snippets are equivalent: Ext.define('User', { extend: 'Ext.data.Model', fields: ['first', 'last'] }); // method 1, access model type through the manager var UserType = Ext.ModelManager.getModel('User'); // method 2, reference the type directly var UserType = User; @markdown @singleton
singleton
typeName

Methods

Name Description
create(object, JsString, JsNumber) Creates a new instance of a Model using the given data. * This method is deprecated. Use {@link Ext#create Ext.create} instead. For example: * Ext.create('User', { first: 'Ed', last: 'Spencer' }); * @param {Object} data Data to initialize the Model's fields with @param {String} name The name of the model to create @param {Number} id (Optional) unique id of the Model instance (see {@link Ext.data.Model})
getModel(object) Returns the {@link Ext.data.Model} for a given model name @param {String/Object} id The id of the model or the model instance. @return {Ext.data.Model} a model class.
onModelDefined(JsAction) @private Private callback called whenever a model has just been defined. This sets up any associations that were waiting for the given model to be defined @param {Function} model The model that was just created
registerDeferredAssociation(Association) Registers an association where one of the models defined doesn't exist yet. The ModelManager will check when new models are registered if it can link them together @private @param {Ext.data.association.Association} association The association
registerType(object, object) Registers a model definition. All model plugins marked with isDefault: true are bootstrapped immediately, as are any addition plugins defined in the model config. @private
© Copyright 2005-2011 SharpKit. All rights reserved.