Ext JS Sencha Docs

Ext.data.Session

Hierarchy

Ext.Base
Ext.data.Session

Requires

Files

This class manages models and their associations. Instances of Session are typically associated with some Component (perhaps the Viewport or a Window) and then used by their view models to enable data binding.

The primary job of a Session is to manage a collection of records of many different types and their associations. This often starts by loading records when requested (via bind - see below) and culminates when it is time to save to the server.

Because the Session tracks all records it loads, it ensures that for any given type of model, only one record exists with a given id. This means that all edits of that record are properly targeted at that one instance.

Similarly, when associations are loaded, the Ext.data.Store created to hold the associated records is tracked by the Session. So all requests for the "OrderItems" of a particular Order id will result in the same Store. Adding and removing items from that Order then is sure to remain consistent.

Data

Since the Session is managing all this data, there are several methods it provides to give convenient access to that data. The most important of these is update and getChanges.

The update and getChanges methods both operate on object that contains a summary of records and associations and different CRUD operations.

Saving

There are two basic ways to save the contents of a Session: getChanges and getSaveBatch. We've already seen getChanges. The data contained in the CRUD object can be translated into whatever shape is needed by the server.

To leverage the proxy facilities defined by each Model class, there is the getSaveBatch method. That method returns an Ext.data.Batch object populated with the necessary create, update and destory operations to save all of the changes in the Session.

Available since: 5.0.0

Defined By

Config options

true to automatically destroy this session when a component it is attached to is destroyed. ...

true to automatically destroy this session when a component it is attached to is destroyed. This should be set to false if the session is intended to be used across multiple root level components.

Defaults to: true

Available since: 5.0.1

Ext.data.Session
view source
: Objectprivate
...

Defaults to: {create: 'C', read: 'R', update: 'U', drop: 'D'}

The parent session for this session.

The parent session for this session.

...

Defaults to: 'default'

Properties

Defined By

Instance properties

...

Defaults to: 'Ext.Base'

The value true causes config values to be stored on instances using a property name prefixed with an underscore ("_")...

The value true causes config values to be stored on instances using a property name prefixed with an underscore ("_") character. A value of false stores config values as properties using their exact name (no prefix).

Defaults to: false

Available since: 5.0.0

Overrides: Ext.Component.$configPrefixed, Ext.layout.Layout.$configPrefixed, Ext.data.AbstractStore.$configPrefixed, Ext.layout.container.boxOverflow.None.$configPrefixed

The value true instructs the initConfig method to only honor values for properties declared in the config block of a ...

The value true instructs the initConfig method to only honor values for properties declared in the config block of a class. When false, properties that are not declared in a config block will be placed on the instance.

Defaults to: true

Available since: 5.0.0

Overrides: Ext.Component.$configStrict, Ext.layout.Layout.$configStrict, Ext.data.AbstractStore.$configStrict, Ext.layout.container.boxOverflow.None.$configStrict

Ext.data.Session
view source
: Objectprivate
...

Defaults to: {C: 1, R: 1, U: 1, D: 1}

Ext.data.Session
view source
: Arrayprivate
...

Defaults to: [{type: 'R', entityMethod: 'readEntities'}, {type: 'C', entityMethod: 'createEntities'}, {type: 'U', entityMethod: 'updateEntities'}, {type: 'D', entityMethod: 'dropEntities'}]

Ext.data.Session
view source
: Booleanprivate
...

Defaults to: false

This property is set to true during the call to initConfig. ...

This property is set to true during the call to initConfig.

Defaults to: false

Available since: 5.0.0

This property is set to true if this instance is the first of its class. ...

This property is set to true if this instance is the first of its class.

Defaults to: false

Available since: 5.0.0

This value is true and is used to identify plain objects from instances of a defined class. ...

This value is true and is used to identify plain objects from instances of a defined class.

Defaults to: true

Ext.data.Session
view source
: Booleanprivate
...

Defaults to: true

Ext.data.Session
view source
: Objectprivate


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, this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics for a detailed comparison

Ext.define('My.Cat', {
    statics: {
        speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
    },

    constructor: function() {
        alert(this.self.speciesName); // dependent on 'this'
    },

    clone: function() {
        return new this.self();
    }
});


Ext.define('My.SnowLeopard', {
    extend: 'My.Cat',
    statics: {
        speciesName: 'Snow Leopard'         // My.SnowLeopard.speciesName = 'Snow Leopard'
    }
});

var cat = new My.Cat();                     // alerts 'Cat'
var snowLeopard = new My.SnowLeopard();     // alerts 'Snow Leopard'

var clone = snowLeopard.clone();
alert(Ext.getClassName(clone));             // alerts 'My.SnowLeopard'
Defined By

Static properties

...

Defaults to: []

Methods

Defined By

Instance methods

Ext.data.Session
view source
new( config ) : Ext.data.Session
...

Parameters

Returns

Fires

    Ext.data.Session
    view source
    ( record )private
    Add a record instance to this session. ...

    Add a record instance to this session. Called by model.

    Parameters

    Fires

      ( deprecations )private
      This method applies a versioned, deprecation declaration to this class. ...

      This method applies a versioned, deprecation declaration to this class. This is typically called by the deprecated config.

      Parameters

      Ext.data.Session
      view source
      ( record )
      Adds an existing record instance to the session. ...

      Adds an existing record instance to the session. The record may not belong to another session. The record cannot be a phantom record, instead use createRecord.

      Parameters

      Fires

        Ext.data.Session
        view source
        ( record )private
        Template method, will be called by Model after a record is dropped. ...

        Template method, will be called by Model after a record is dropped.

        Parameters

        Fires

          Ext.data.Session
          view source
          ( schema )private
          ...

          Parameters

          ( args ) : Objectdeprecatedprotected
          Call the original method that was previously overridden with override Ext.define('My.Cat', { constructor: functi...

          Call the original method that was previously overridden with override

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

          This method has been deprecated

          Use callParent instead.

          Parameters

          • args : Array/Arguments

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

          Returns

          • Object

            Returns the result of calling the overridden method

          Call the "parent" method of the current method. ...

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

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

          This can be used with an override as follows:

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

          This also works with static methods.

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

          Lastly, it also works with overridden static methods.

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

          To override a method and replace it and also call the superclass method, use callSuper. This is often done to patch a method to fix a bug.

          Parameters

          • args : Array/Arguments

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

          Returns

          • Object

            Returns the result of calling the parent method

          This method is used by an override to call the superclass method but bypass any overridden method. ...

          This method is used by an override to call the superclass method but bypass any overridden method. This is often done to "patch" a method that contains a bug but for whatever reason cannot be fixed directly.

          Consider:

           Ext.define('Ext.some.Class', {
               method: function () {
                   console.log('Good');
               }
           });
          
           Ext.define('Ext.some.DerivedClass', {
               extend: 'Ext.some.Class',
          
               method: function () {
                   console.log('Bad');
          
                   // ... logic but with a bug ...
          
                   this.callParent();
               }
           });
          

          To patch the bug in Ext.some.DerivedClass.method, the typical solution is to create an override:

           Ext.define('App.patches.DerivedClass', {
               override: 'Ext.some.DerivedClass',
          
               method: function () {
                   console.log('Fixed');
          
                   // ... logic but with bug fixed ...
          
                   this.callSuper();
               }
           });
          

          The patch method cannot use callParent to call the superclass method since that would call the overridden method containing the bug. In other words, the above patch would only produce "Fixed" then "Good" in the console log, whereas, using callParent would produce "Fixed" then "Bad" then "Good".

          Parameters

          • args : Array/Arguments

            The arguments, either an array or the arguments object from the current method, for example: this.callSuper(arguments)

          Returns

          • Object

            Returns the result of calling the superclass method

          Ext.data.Session
          view source
          ( name )private
          Checks if the model type being referenced is valid for this session. ...

          Checks if the model type being referenced is valid for this session. That includes checking if the model name is correct & is one used in this schema for this session. Will raise an exception if the model type is not correct.

          Parameters

          Fires

            Ext.data.Session
            view source
            ( )private
            ...
            Ext.data.Session
            view source
            ( entityType, items )private
            Process a create block of entities from the update method. ...

            Process a create block of entities from the update method.

            Parameters

            • entityType : Ext.Class

              The entity type.

            • items : Object[]

              The data objects to create.

            Fires

              Ext.data.Session
              view source
              ( type, [data] ) : Ext.data.Model
              Creates a new record and tracks it in this session. ...

              Creates a new record and tracks it in this session.

              Parameters

              • type : String/Ext.Class

                The entityName or the actual class of record to create.

              • data : Object (optional)

                The data for the record.

              Returns

              Fires

                Ext.data.Session
                view source
                ( )protected
                This method is called to cleanup an object and its resources. ...
                Ext.data.Session
                view source
                ( entityType, ids )private
                Process a drop block for entities from the update method. ...

                Process a drop block for entities from the update method.

                Parameters

                • entityType : Ext.Class

                  The entity type.

                • ids : Object[]

                  The identifiers of the items to drop.

                Fires

                  Ext.data.Session
                  view source
                  ( record )private
                  Remove a record and any references from the session. ...

                  Remove a record and any references from the session.

                  Parameters

                  Ext.data.Session
                  view source
                  ( ) : Boolean
                  Returns the value of autoDestroy. ...

                  Returns the value of autoDestroy.

                  Available since: 5.0.1

                  Returns

                  Ext.data.Session
                  view source
                  ( ) : Object
                  Returns an object describing all of the modified fields, created or dropped records and many-to-many association chan...

                  Returns an object describing all of the modified fields, created or dropped records and many-to-many association changes maintained by this session.

                  Returns

                  • Object

                    An object in the CRUD format (see the intro docs). null if there are no changes.

                  Fires

                    Ext.data.Session
                    view source
                    ( ) : Objectprotected
                    The same functionality as getChanges, however we also take into account our parent session. ...

                    The same functionality as getChanges, however we also take into account our parent session.

                    Returns

                    • Object

                      An object in the CRUD format (see the intro docs). null if there are no changes.

                    Fires

                      Returns a specified config property value. ...

                      Returns a specified config property value. If the name parameter is not passed, all current configuration options will be returned as key value pairs.

                      Parameters

                      • name : String (optional)

                        The name of the config property to get.

                      • peek : Boolean (optional)

                        true to peek at the raw value without calling the getter.

                        Defaults to: false

                      Returns

                      • Object

                        The config property value.

                      Returns the value of crudProperties. ...

                      Returns the value of crudProperties.

                      Returns

                      Ext.data.Session
                      view source
                      ( entityType, ids ) : Ext.data.Model[]
                      Transforms a list of ids into a list of records for a particular type. ...

                      Transforms a list of ids into a list of records for a particular type.

                      Parameters

                      • entityType : Ext.Class

                        The entity type.

                      • ids : Object[]

                        The ids to transform.

                      Returns

                      Fires

                        Ext.data.Session
                        view source
                        ( type, id ) : Objectprivate
                        Return an entry for the data property for a particular type/id. ...

                        Return an entry for the data property for a particular type/id.

                        Parameters

                        Returns

                        Fires

                          Returns the initial configuration passed to constructor when instantiating this class. ...

                          Returns the initial configuration passed to constructor when instantiating this class.

                          Parameters

                          • name : String (optional)

                            Name of the config option to return.

                          Returns

                          • Object/Mixed

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

                          Ext.data.Session
                          view source
                          ( entityType, id ) : String
                          Gets a user friendly identifier for a Model. ...

                          Gets a user friendly identifier for a Model.

                          Parameters

                          Returns

                          Returns the value of parent. ...

                          Returns the value of parent.

                          Returns

                          Ext.data.Session
                          view source
                          ( type, id, [autoLoad] ) : Ext.data.Model
                          Get a cached record from the session. ...

                          Get a cached record from the session. If the record does not exist, it will be created. If the autoLoad parameter is not set to false, the record will be loaded via the proxy of the Model.

                          If this session is configured with a parent session, a copy of any existing record in the parent will be adopted into this session. If the parent does not contain the record, the record will be created and not inserted into the parent.

                          See also peekRecord.

                          Parameters

                          • type : String/Ext.Class

                            The entityName or the actual class of record to create.

                          • id : Object

                            The id of the record.

                          • autoLoad : Boolean/Object (optional)

                            false to prevent the record from being loaded if it does not exist. If this parameter is an object, it will be passed to the Ext.data.Model.load call.

                            Defaults to: true

                          Returns

                          Fires

                            Ext.data.Session
                            view source
                            ( [sort] ) : Ext.data.Batch
                            Returns an Ext.data.Batch containing the Ext.data.operation.Operation instances that are needed to save all of the ch...

                            Returns an Ext.data.Batch containing the Ext.data.operation.Operation instances that are needed to save all of the changes in this session. This sorting is based on operation type, associations and foreign keys. Generally speaking the operations in the batch can be committed to a server sequentially and the server will never be sent a request with an invalid (client-generated) id in a foreign key field.

                            Parameters

                            • sort : Boolean (optional)

                              Pass false to disable the batch operation sort.

                              Defaults to: true

                            Returns

                            Fires

                              Returns the value of schema. ...

                              Returns the value of schema.

                              Returns

                              ...

                              Parameters

                              ( config ) : Ext.Basechainableprotected
                              Initialize configuration for this class. ...

                              Initialize configuration for this class. a typical example:

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

                              Parameters

                              Returns

                              Fires

                                Ext.data.Session
                                view source
                                ( entityType, id )protectedtemplate
                                Triggered when an associated item from update references a record that does not exist in the session. ...

                                Triggered when an associated item from update references a record that does not exist in the session.

                                This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

                                Parameters

                                Fires

                                  Ext.data.Session
                                  view source
                                  ( entityType, id )protectedtemplate
                                  Triggered when an drop block from update tries to create a record that already exists. ...

                                  Triggered when an drop block from update tries to create a record that already exists.

                                  This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

                                  Parameters

                                  Fires

                                    Ext.data.Session
                                    view source
                                    ( entityType, id )protectedtemplate
                                    Triggered when an drop block from update references a record that does not exist in the session. ...

                                    Triggered when an drop block from update references a record that does not exist in the session.

                                    This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

                                    Parameters

                                    Fires

                                      Ext.data.Session
                                      view source
                                      ( entityType, id )protectedtemplate
                                      Triggered when an drop block from update tries to create a record that already exists. ...

                                      Triggered when an drop block from update tries to create a record that already exists.

                                      This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

                                      Parameters

                                      Fires

                                        Ext.data.Session
                                        view source
                                        ( entityType, id, dropped )protectedtemplate
                                        Triggered when an update block from update references a record that does not exist in the session. ...

                                        Triggered when an update block from update references a record that does not exist in the session.

                                        This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

                                        Parameters

                                        • entityType : Ext.Class

                                          The entity type.

                                        • id : Object

                                          The id of the model.

                                        • dropped : Boolean

                                          true if the record was dropped.

                                        Fires

                                          Ext.data.Session
                                          view source
                                          ( type, id, [deep] ) : Ext.data.Model
                                          Gets an existing record from the session. ...

                                          Gets an existing record from the session. The record will not be created if it does not exist.

                                          See also: getRecord.

                                          Parameters

                                          • type : String/Ext.Class

                                            The entityName or the actual class of record to create.

                                          • id : Object

                                            The id of the record.

                                          • deep : Boolean (optional)

                                            true to consult

                                            Defaults to: false

                                          Returns

                                          Fires

                                            Ext.data.Session
                                            view source
                                            ( entityType, items )private
                                            Process a read block of entities from the update method. ...

                                            Process a read block of entities from the update method.

                                            Parameters

                                            • entityType : Ext.Class

                                              The entity type.

                                            • items : Object[]

                                              The data objects to read.

                                            Fires

                                              Ext.data.Session
                                              view source
                                              ( )
                                              Save any changes in this session to a parent session. ...

                                              Save any changes in this session to a parent session.

                                              Fires

                                                Ext.data.Session
                                                view source
                                                ( autoDestroy )
                                                Sets the value of autoDestroy. ...

                                                Sets the value of autoDestroy.

                                                Available since: 5.0.1

                                                Parameters

                                                ( name, [value] ) : Ext.Basechainable
                                                Sets a single/multiple configuration options. ...

                                                Sets a single/multiple configuration options.

                                                Parameters

                                                • name : String/Object

                                                  The name of the property to set, or a set of key value pairs to set.

                                                • value : Object (optional)

                                                  The value to set for the name parameter.

                                                Returns

                                                Fires

                                                  Ext.data.Session
                                                  view source
                                                  ( crudProperties )
                                                  Sets the value of crudProperties. ...

                                                  Sets the value of crudProperties.

                                                  Parameters

                                                  Ext.data.Session
                                                  view source
                                                  ( parent )
                                                  Sets the value of parent. ...

                                                  Sets the value of parent.

                                                  Parameters

                                                  Ext.data.Session
                                                  view source
                                                  ( schema )
                                                  Sets the value of schema. ...

                                                  Sets the value of schema.

                                                  Parameters

                                                  Ext.data.Session
                                                  view source
                                                  ( ) : Ext.data.Session
                                                  Create a child session with this session as the parent. ...

                                                  Create a child session with this session as the parent.

                                                  Returns

                                                  Fires

                                                    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, this.statics() is scope-independent and it always returns the class from which it was called, regardless of what this points to during run-time

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

                                                    Returns

                                                    Ext.data.Session
                                                    view source
                                                    ( data )
                                                    Complete a bulk update for this session. ...

                                                    Complete a bulk update for this session.

                                                    Parameters

                                                    • data : Object

                                                      Data in the CRUD format (see the intro docs).

                                                    Fires

                                                      Ext.data.Session
                                                      view source
                                                      ( entityType, items )private
                                                      Process an update block for entities from the update method. ...

                                                      Process an update block for entities from the update method.

                                                      Parameters

                                                      • entityType : Ext.Class

                                                        The entity type.

                                                      • items : Object[]

                                                        The data objects to update.

                                                      Fires

                                                        Ext.data.Session
                                                        view source
                                                        ( visitor ) : Object
                                                        Walks the internal data tracked by this session and calls methods on the provided visitor object. ...

                                                        Walks the internal data tracked by this session and calls methods on the provided visitor object. The visitor can then accumulate whatever data it finds important. The visitor object can provide a number of methods, but all are optional.

                                                        This method does not enumerate associations since these can be traversed given the records that are enumerated. For many-to-many associations, however, this method does enumerate the changes because these changes are not "owned" by either side of such associations.

                                                        Parameters

                                                        • visitor : Object
                                                          • onCleanRecord : Function (optional)

                                                            This method is called to describe a record that is known but unchanged.

                                                            Parameters

                                                          • onDirtyRecord : Function (optional)

                                                            This method is called to describe a record that has either been created, dropped or modified.

                                                            Parameters

                                                          • onMatrixChange : Function (optional)

                                                            This method is called to describe a change in a many-to-many association (a "matrix").

                                                            Parameters

                                                            • association : Ext.data.schema.Association

                                                              The object describing the many-to-many ("matrix") association.

                                                            • leftId : Mixed

                                                              The idProperty of the record on the "left" of the association.

                                                            • rightId : Mixed

                                                              The idProperty of the record on the "right" of the association.

                                                            • state : Number

                                                              A negative number if the two records are being disassociated or a positive number if they are being associated. For example, when adding User 10 to Group 20, this would be 1. When removing the User this argument would be -1.

                                                        Returns

                                                        Fires

                                                          Defined By

                                                          Static methods

                                                          ( config, [mixinClass] )privatestatic
                                                          Adds new config properties to this class. ...

                                                          Adds new config properties to this class. This is called for classes when they are declared, then for any mixins that class may define and finally for any overrides defined that target the class.

                                                          Parameters

                                                          • config : Object
                                                          • mixinClass : Class (optional)

                                                            The mixin class if the configs are from a mixin.

                                                          ( members )chainableprivatestatic
                                                          ...

                                                          Parameters

                                                          ( name, member )chainableprivatestatic
                                                          ...

                                                          Parameters

                                                          ( members, [isStatic], [privacy] )chainablestatic
                                                          Add methods / properties to the prototype of this class. ...

                                                          Add methods / properties to the prototype of this class.

                                                          Ext.define('My.awesome.Cat', {
                                                              constructor: function() {
                                                                  ...
                                                              }
                                                          });
                                                          
                                                           My.awesome.Cat.addMembers({
                                                               meow: function() {
                                                                  alert('Meowww...');
                                                               }
                                                           });
                                                          
                                                           var kitty = new My.awesome.Cat();
                                                           kitty.meow();
                                                          

                                                          Parameters

                                                          • members : Object

                                                            The members to add to this class.

                                                          • isStatic : Boolean (optional)

                                                            Pass true if the members are static.

                                                            Defaults to: false

                                                          • privacy : Boolean (optional)

                                                            Pass true if the members are private. This only has meaning in debug mode and only for methods.

                                                            Defaults to: false

                                                          ( members ) : Ext.Basechainablestatic
                                                          Add / override static properties of this class. ...

                                                          Add / override static properties of this class.

                                                          Ext.define('My.cool.Class', {
                                                              ...
                                                          });
                                                          
                                                          My.cool.Class.addStatics({
                                                              someProperty: 'someValue',      // My.cool.Class.someProperty = 'someValue'
                                                              method1: function() { ... },    // My.cool.Class.method1 = function() { ... };
                                                              method2: function() { ... }     // My.cool.Class.method2 = function() { ... };
                                                          });
                                                          

                                                          Parameters

                                                          Returns

                                                          ( fromClass, members ) : Ext.Baseprivatestatic
                                                          Borrow another class' members to the prototype of this class. ...

                                                          Borrow another class' members to the prototype of this class.

                                                          Ext.define('Bank', {
                                                              money: '$$$',
                                                              printMoney: function() {
                                                                  alert('$$$$$$$');
                                                              }
                                                          });
                                                          
                                                          Ext.define('Thief', {
                                                              ...
                                                          });
                                                          
                                                          Thief.borrow(Bank, ['money', 'printMoney']);
                                                          
                                                          var steve = new Thief();
                                                          
                                                          alert(steve.money); // alerts '$$$'
                                                          steve.printMoney(); // alerts '$$$$$$$'
                                                          

                                                          Parameters

                                                          • fromClass : Ext.Base

                                                            The class to borrow members from

                                                          • members : Array/String

                                                            The names of the members to borrow

                                                          Returns

                                                          ( args )protectedstatic
                                                          ...

                                                          Parameters

                                                          ( args )protectedstatic
                                                          ...

                                                          Parameters

                                                          Create a new instance of this Class. ...

                                                          Create a new instance of this Class.

                                                          Ext.define('My.cool.Class', {
                                                              ...
                                                          });
                                                          
                                                          My.cool.Class.create({
                                                              someConfig: true
                                                          });
                                                          

                                                          All parameters are passed to the constructor of the class.

                                                          Returns

                                                          ( alias, origin )static
                                                          Create aliases for existing prototype methods. ...

                                                          Create aliases for existing prototype methods. Example:

                                                          Ext.define('My.cool.Class', {
                                                              method1: function() { ... },
                                                              method2: function() { ... }
                                                          });
                                                          
                                                          var test = new My.cool.Class();
                                                          
                                                          My.cool.Class.createAlias({
                                                              method3: 'method1',
                                                              method4: 'method2'
                                                          });
                                                          
                                                          test.method3(); // test.method1()
                                                          
                                                          My.cool.Class.createAlias('method5', 'method3');
                                                          
                                                          test.method5(); // test.method3() -> test.method1()
                                                          

                                                          Parameters

                                                          ( config )privatestatic
                                                          ...

                                                          Parameters

                                                          Returns the Ext.Configurator for this class. ...

                                                          Returns the Ext.Configurator for this class.

                                                          Returns

                                                          Get the current class' name in string format. ...

                                                          Get the current class' name in string format.

                                                          Ext.define('My.cool.Class', {
                                                              constructor: function() {
                                                                  alert(this.self.getName()); // alerts 'My.cool.Class'
                                                              }
                                                          });
                                                          
                                                          My.cool.Class.getName(); // 'My.cool.Class'
                                                          

                                                          Returns

                                                          ( name, mixinClass )privatestatic
                                                          Used internally by the mixins pre-processor ...

                                                          Used internally by the mixins pre-processor

                                                          Parameters

                                                          ( fn, scope )chainableprivatestatic
                                                          ...

                                                          Parameters

                                                          Override members of this class. ...

                                                          Override members of this class. Overridden methods can be invoked via callParent.

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

                                                          Direct use of this method should be rare. Use Ext.define instead:

                                                          Ext.define('My.CatOverride', {
                                                              override: 'My.Cat',
                                                              constructor: function() {
                                                                  alert("I'm going to be a cat!");
                                                          
                                                                  this.callParent(arguments);
                                                          
                                                                  alert("Meeeeoooowwww");
                                                              }
                                                          });
                                                          

                                                          The above accomplishes the same result but can be managed by the Ext.Loader which can properly order the override and its target class and the build process can determine whether the override is needed based on the required state of the target class (My.Cat).

                                                          Parameters

                                                          • members : Object

                                                            The properties to add to this class. This should be specified as an object literal containing one or more properties.

                                                          Returns