Touch 2.0.2 Sencha Docs

Ext.data.Store

Hierarchy

Ext.Base
Ext.Evented
Ext.data.Store

Inherited mixins

Requires

Subclasses

Files

The Store class encapsulates a client side cache of Model objects. Stores load data via a Proxy, and also provide functions for sorting, filtering and querying the model instances contained within it.

Creating a Store is easy - we just tell it the Model and the Proxy to use to load and save its data:

// Set up a model to use in our Store
Ext.define('User', {
    extend: 'Ext.data.Model',
    config: {
        fields: [
            {name: 'firstName', type: 'string'},
            {name: 'lastName',  type: 'string'},
            {name: 'age',       type: 'int'},
            {name: 'eyeColor',  type: 'string'}
        ]
    }
});

var myStore = Ext.create('Ext.data.Store', {
    model: 'User',
    proxy: {
        type: 'ajax',
        url : '/users.json',
        reader: {
            type: 'json',
            rootProperty: 'users'
        }
    },
    autoLoad: true
});

In the example above we configured an AJAX proxy to load data from the url '/users.json'. We told our Proxy to use a JsonReader to parse the response from the server into Model object - see the docs on JsonReader for details.

Inline data

Stores can also load data inline. Internally, Store converts each of the objects we pass in as data into Model instances:

Ext.create('Ext.data.Store', {
    model: 'User',
    data : [
        {firstName: 'Ed',    lastName: 'Spencer'},
        {firstName: 'Tommy', lastName: 'Maintz'},
        {firstName: 'Aaron', lastName: 'Conran'},
        {firstName: 'Jamie', lastName: 'Avins'}
    ]
});

Loading inline data using the method above is great if the data is in the correct format already (e.g. it doesn't need to be processed by a reader). If your inline data requires processing to decode the data structure, use a MemoryProxy instead (see the MemoryProxy docs for an example).

Additional data can also be loaded locally using add.

Loading Nested Data

Applications often need to load sets of associated data - for example a CRM system might load a User and her Orders. Instead of issuing an AJAX request for the User and a series of additional AJAX requests for each Order, we can load a nested dataset and allow the Reader to automatically populate the associated models. Below is a brief example, see the Ext.data.reader.Reader intro docs for a full explanation:

var store = Ext.create('Ext.data.Store', {
    autoLoad: true,
    model: "User",
    proxy: {
        type: 'ajax',
        url : 'users.json',
        reader: {
            type: 'json',
            rootProperty: 'users'
        }
    }
});

Which would consume a response like this:

{
    "users": [
        {
            "id": 1,
            "name": "Ed",
            "orders": [
                {
                    "id": 10,
                    "total": 10.76,
                    "status": "invoiced"
                },
                {
                    "id": 11,
                    "total": 13.45,
                    "status": "shipped"
                }
            ]
        }
    ]
}

See the Ext.data.reader.Reader intro docs for a full explanation.

Filtering and Sorting

Stores can be sorted and filtered - in both cases either remotely or locally. The sorters and filters are held inside MixedCollection instances to make them easy to manage. Usually it is sufficient to either just specify sorters and filters in the Store configuration or call sort or filter:

var store = Ext.create('Ext.data.Store', {
    model: 'User',
    sorters: [
        {
            property : 'age',
            direction: 'DESC'
        },
        {
            property : 'firstName',
            direction: 'ASC'
        }
    ],

    filters: [
        {
            property: 'firstName',
            value   : /Ed/
        }
    ]
});

The new Store will keep the configured sorters and filters in the MixedCollection instances mentioned above. By default, sorting and filtering are both performed locally by the Store - see remoteSort and remoteFilter to allow the server to perform these operations instead.

Filtering and sorting after the Store has been instantiated is also easy. Calling filter adds another filter to the Store and automatically filters the dataset (calling filter with no arguments simply re-applies all existing filters). Note that by default your sorters are automatically reapplied if using local sorting.

 store.filter('eyeColor', 'Brown');

Change the sorting at any time by calling sort:

 store.sort('height', 'ASC');

Note that all existing sorters will be removed in favor of the new sorter data (if sort is called with no arguments, the existing sorters are just reapplied instead of being removed). To keep existing sorters and add new ones, just add them to the MixedCollection:

store.sorters.add(new Ext.util.Sorter({
    property : 'shoeSize',
    direction: 'ASC'
}));

store.sort();

Registering with StoreManager

Any Store that is instantiated with a storeId will automatically be registed with the StoreManager. This makes it easy to reuse the same store in multiple views:

//this store can be used several times
Ext.create('Ext.data.Store', {
    model: 'User',
    storeId: 'usersStore'
});

new Ext.List({
    store: 'usersStore',

    //other config goes here
});

new Ext.view.View({
    store: 'usersStore',

    //other config goes here
});

Further Reading

Stores are backed up by an ecosystem of classes that enables their operation. To gain a full understanding of these pieces and how they fit together, see:

  • Proxy - overview of what Proxies are and how they are used
  • Model - the core class in the data package
  • Reader - used by any subclass of ServerProxy to read a response

Available since: 1.1.0

Defined By

Config options

Ext.data.Store
view source
: Booleanprivate
This is a private configuration used in the framework whether this Store can be destroyed. ...

This is a private configuration used in the framework whether this Store can be destroyed.

Defaults to: false

Available since: 2.0.0

If data is not specified, and if autoLoad is true or an Object, this store's load method is automatically called afte...

If data is not specified, and if autoLoad is true or an Object, this store's load method is automatically called after creation. If the value of autoLoad is an Object, this Object will be passed to the store's load method. Defaults to false.

Available since: 1.1.0

True to automatically sync the Store with its Proxy after every edit to one of its Records. ...

True to automatically sync the Store with its Proxy after every edit to one of its Records. Defaults to false.

Defaults to: false

Available since: 2.0.0

The event name to bubble, or an Array of event names.

The event name to bubble, or an Array of event names.

Available since: 2.0.0

True to empty the store when loading another page via loadPage, nextPage or previousPage (defaults to true). ...

True to empty the store when loading another page via loadPage, nextPage or previousPage (defaults to true). Setting to false keeps existing records, allowing large data sets to be loaded one page at a time but rendered all together.

Defaults to: true

Available since: 1.1.0

Array of Model instances or data objects to load locally. ...

Array of Model instances or data objects to load locally. See "Inline data" above for details.

Available since: 1.1.0

This configuation allows you to prevent destroying record instances when they are removed from this store and are not...

This configuation allows you to prevent destroying record instances when they are removed from this store and are not in any other store.

Defaults to: true

Available since: 2.0.1

Ext.data.Store
view source
: Object[]
This may be used in place of specifying a model configuration. ...

This may be used in place of specifying a model configuration. The fields should be a set of Ext.data.Field configuration objects. The store will automatically create a Ext.data.Model with these fields. In general this configuration option should be avoided, it exists for the purposes of backwards compatibility. For anything more complicated, such as specifying a particular id property or associations, a Ext.data.Model should be defined and specified for the model config.

Available since: 2.0.0

Ext.data.Store
view source
: Object[]
Array of Filters for this store. ...

Array of Filters for this store. This configuration is handled by the Filterable mixin of the data collection.

Available since: 2.0.0

Ext.data.Store
view source
: Functiondeprecated
This function will be passed to the grouper configuration as it's groupFn. ...

This function will be passed to the grouper configuration as it's groupFn. Note that this configuration is deprecated and grouper: {groupFn: yourFunction}} is preferred.

This cfg has been deprecated

Available since: 2.0.0

Ext.data.Store
view source
: String
The direction in which sorting should be applied when grouping. ...

The direction in which sorting should be applied when grouping. If you specify a grouper by using the groupField configuration, this will automatically default to "ASC" - the other supported value is "DESC"

Available since: 2.0.0

The (optional) field by which to group data in the store. ...

The (optional) field by which to group data in the store. Internally, grouping is very similar to sorting - the groupField and groupDir are injected as the first sorter (see sort). Stores support a single level of grouping, and groups can be fetched via the getGroups method.

Available since: 2.0.0

Ext.data.Store
view source
: Object[]
A configuration object for this Store's grouper. ...

A configuration object for this Store's grouper.

For example, to group a store's items by the first letter of the last name:

Ext.define('People', {
    extend: 'Ext.data.Store',

    config: {
        fields: ['first_name', 'last_name'],

        grouper: {
            groupFn: function(record) {
                return record.get('last_name').substr(0, 1);
            },
            sortProperty: 'last_name'
        }
    }
});

Available since: 2.0.0

A config object containing one or more event handlers to be added to this object during initialization. ...

A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.

See the Event guide for more

Note it is bad practice to specify a listeners config when you are defining a class using Ext.define. Instead, only specify listeners when you are instantiating your class with Ext.create.

Available since: 1.1.0

Ext.data.Store
view source
: String
Name of the Model associated with this store. ...

Name of the Model associated with this store. The string is used as an argument for Ext.ModelManager.getModel.

Available since: 2.0.0

Ext.data.Store
view source
: Objectprivate
...

Defaults to: {}

Available since: 2.0.0

Ext.data.Store
view source
: Number
The number of records considered to form a 'page'. ...

The number of records considered to form a 'page'. This is used to power the built-in paging using the nextPage and previousPage functions. Defaults to 25.

Defaults to: 25

Available since: 2.0.0

The Proxy to use for this Store. ...

The Proxy to use for this Store. This can be either a string, a config object or a Proxy instance - see setProxy for details.

Available since: 1.1.0

True to defer any filtering operation to the server. ...

True to defer any filtering operation to the server. If false, filtering is done locally on the client. Defaults to false.

If this is set to true, you will have to manually call the load method after you filter to retrieve the filtered data from the server.

Defaults to: false

Available since: 1.1.0

True to defer any grouping operation to the server. ...

True to defer any grouping operation to the server. If false, grouping is done locally on the client. Defaults to false

Defaults to: false

Available since: 2.0.0

True to defer any sorting operation to the server. ...

True to defer any sorting operation to the server. If false, sorting is done locally on the client. Defaults to false.

If this is set to true, you will have to manually call the load method after you sort, to retrieve the sorted data from the server.

Defaults to: false

Available since: 1.1.0

Ext.data.Store
view source
: Object[]
Array of Sorters for this store. ...

Array of Sorters for this store. This configuration is handled by the Sortable mixin of the data collection. See also the sort method.

Available since: 2.0.0

Ext.data.Store
view source
: String
Unique identifier for this store. ...

Unique identifier for this store. If present, this Store will be registered with the Ext.data.StoreManager, making it easy to reuse elsewhere.

Available since: 1.1.0

This configuration allows you to disable the synchronization of removed records on this Store. ...

This configuration allows you to disable the synchronization of removed records on this Store. By default, when you call removeAll or remove, records will be added to an internal removed array. When you then sync the Store, we send a destroy request for these records. If you don't want this to happen, you can set this configuration to false.

Defaults to: true

Available since: 2.0.0

The total number of records in the full dataset, as indicated by a server. ...

The total number of records in the full dataset, as indicated by a server. If the server-side dataset contains 5000 records but only returns pages of 50 at a time, totalCount will be set to 5000 and getCount will return 50

Available since: 2.0.0

Properties

Defined By

Instance Properties

The page that the Store has most recently loaded (see loadPage) ...

The page that the Store has most recently loaded (see loadPage)

Defaults to: 1

Available since: 1.1.0

...

Defaults to: 'ext-'

Available since: 2.0.0

...

Defaults to: '-'

Available since: 2.0.0

...

Defaults to: /\.|[^\w\-]/g

Available since: 2.0.0

...

Defaults to: false

Available since: 2.0.0

...

Defaults to: true

Available since: 2.0.0

...

Defaults to: true

Available since: 1.1.0

Ext.data.Store
view source
: Booleanprivate
...

Defaults to: true

Available since: 1.1.0

...

Defaults to: /^(?:delegate|single|delay|buffer|args|prepend)$/

Available since: 2.0.0

...

Defaults to: {id: 'observable', hooks: {destroy: 'destroy'}}

Available since: 2.0.0

...

Defaults to: 'identifiable'

Available since: 2.0.0

...

Defaults to: '#'

Available since: 2.0.0

...

Defaults to: 'observable'

Available since: 2.0.0

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); / dependentOL 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'

Available since: 2.0.0

...

Defaults to: /^([\w\-]+)$/

Available since: 2.0.0

Defined By

Static Properties

...

Defaults to: []

Available since: 2.0.0

Methods

Defined By

Instance Methods

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

Available since: 1.1.0

Parameters

Returns

Overrides: Ext.Evented.constructor

Ext.data.Store
view source
( model ) : Ext.data.Model[]
Adds Model instance to the Store. ...

Adds Model instance to the Store. This method accepts either:

  • An array of Model instances or Model configuration objects.
  • Any number of Model instance or Model configuration object arguments.

The new Model instances will be added at the end of the existing collection.

Sample usage:

myStore.add({some: 'data2'}, {some: 'other data2'});

Available since: 1.1.0

Parameters

  • model : Ext.data.Model[]/Ext.data.Model...

    An array of Model instances or Model configuration objects, or variable number of Model instance or config arguments.

Returns

( eventName, fn, [scope], [options] )
Appends an after-event handler. ...

Appends an after-event handler.

Same as addListener with order set to 'after'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event to listen for.

  • fn : Function

    The method the event invokes.

  • scope : Object (optional)

    The scope for fn.

  • options : Object (optional)

    An object containing handler configuration.

( eventName, fn, [scope], [options] )
Appends a before-event handler. ...

Appends a before-event handler. Returning false from the handler will stop the event.

Same as addListener with order set to 'before'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event to listen for.

  • fn : Function

    The method the event invokes.

  • scope : Object (optional)

    The scope for fn.

  • options : Object (optional)

    An object containing handler configuration.

Ext.data.Store
view source
( data )private
...

Available since: 2.0.0

Parameters

( selector, name, fn, scope, options, order )private
...

Available since: 2.0.0

Parameters

Adds the specified events to the list of events which this Observable may fire. ...

Adds the specified events to the list of events which this Observable may fire.

This method has been deprecated since 2.0

It's no longer needed to add events before firing.

Available since: 1.1.0

Parameters

  • eventNames : Object/String...

    Either an object with event names as properties with a value of true or the first event name string if multiple event names are being passed as separate parameters.

( eventName, fn, [scope], [options], [order] )
Appends an event handler to this object. ...

Appends an event handler to this object. You can review the available handlers by looking at the 'events' section of the documentation for the component you are working with.

Combining Options

Using the options argument, it is possible to combine different types of listeners:

A delayed, one-time listener:

container.on('tap', this.handleTap, this, {
    single: true,
    delay: 100
});

Attaching multiple handlers in 1 call

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

container.on({
    tap  : this.onTap,
    swipe: this.onSwipe,

    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

container.on({
    tap  : { fn: this.onTap, scope: this, single: true },
    swipe: { fn: button.onSwipe, scope: button }
});

See the Events Guide for more.

Available since: 1.1.0

Parameters

  • eventName : String

    The name of the event to listen for. May also be an object who's property names are event names.

  • fn : Function

    The method the event invokes. Will be called with arguments given to fireEvent plus the options parameter described below.

  • scope : Object (optional)

    The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

  • options : Object (optional)

    An object containing handler configuration.

    This object may contain any of the following properties:

    • scope : Object

      The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

    • delay : Number

      The number of milliseconds to delay the invocation of the handler after the event fires.

    • single : Boolean

      True to add a handler to handle just the next firing of the event, and then remove itself.

    • order : String

      The order of when the listener should be added into the listener queue.

      If you set an order of before and the event you are listening to is preventable, you can return false and it will stop the event.

      Available options are before, current and after. Defaults to current.

    • buffer : Number

      Causes the handler to be delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.

    • element : String

      Allows you to add a listener onto a element of this component using the elements reference.

      Ext.create('Ext.Component', {
          listeners: {
              element: 'element',
              tap: function() {
                  console.log('element tap!');
              }
          }
      });
      

      All components have the element reference, which is the outer most element of the component. Ext.Container also has the innerElement element which contains all children. In most cases element is adequate.

    • delegate : String

      Uses Ext.ComponentQuery to delegate events to a specified query selector within this item.

      // Create a container with a two children; a button and a toolbar
      var container = Ext.create('Ext.Container', {
          items: [
              {
                 xtype: 'toolbar',
                 docked: 'top',
                 title: 'My Toolbar'
              },
              {
                 xtype: 'button',
                 text: 'My Button'
              }
          ]
      });
      
      container.on({
          // Ext.Buttons have an xtype of 'button', so we use that are a selector for our delegate
          delegate: 'button',
      
          tap: function() {
              alert('Button tapped!');
          }
      });
      
  • order : String (optional)

    The order of when the listener should be added into the listener queue. Possible values are before, current and after.

    Defaults to: 'current'

( object, eventName, [fn], [scope], [options] )deprecated
Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed. ...

Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed.

This method has been deprecated since 2.0

All listeners are now automatically managed where necessary. Simply use addListener.

Available since: 1.1.0

Parameters

  • object : Ext.mixin.Observable/HTMLElement

    The item to which to add a listener/listeners.

  • eventName : Object/String

    The event name, or an object containing event name properties.

  • fn : Function (optional)

    If the eventName parameter was an event name, this is the handler function.

  • scope : Object (optional)

    If the eventName parameter was an event name, this is the scope in which the handler function is executed.

  • options : Object (optional)

    If the eventName parameter was an event name, this is the addListener options.

Ext.data.Store
view source
( record )private
A model instance should call this method on the Store it has been joined to. ...

A model instance should call this method on the Store it has been joined to.

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( record, modifiedFieldNames )private
A model instance should call this method on the Store it has been joined to. ...

A model instance should call this method on the Store it has been joined to.

Available since: 1.1.0

Parameters

  • record : Ext.data.Model

    The model instance that was edited

  • modifiedFieldNames : String[]

    Array of field names changed during edit.

Ext.data.Store
view source
( record )private
This gets called by a record after is gets erased from the server. ...

This gets called by a record after is gets erased from the server.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( record )private
A model instance should call this method on the Store it has been joined to.. ...

A model instance should call this method on the Store it has been joined to..

Available since: 1.1.0

Parameters

...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( data )
We are using applyData so that we can return nothing and prevent the this.data property to be overridden. ...

We are using applyData so that we can return nothing and prevent the this.data property to be overridden.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( getGroupStringFn )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( grouper )private
...

Available since: 2.0.0

Parameters

...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( model )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( proxy, currentProxy )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( storeId )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( field ) : Object
Gets the average value in the store. ...

Gets the average value in the store.

Available since: 2.0.0

Parameters

  • field : String

    The field in each record you want to get the average for.

Returns

  • Object

    The average value, if no items exist, 0.

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!");

        var instance = this.callOverridden();

        alert("Meeeeoooowwww");

        return instance;
    }
});

var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
                          // alerts "I'm a cat!"
                          // alerts "Meeeeoooowwww"

Available since: 2.0.0

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

Available since: 2.0.0

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

( operation, eventName, fn, scope, options, order )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( )private
...

Available since: 1.1.0

Ext.data.Store
view source
( [suppressEvent] )
Reverts to a view of the Record cache with no filtering applied. ...

Reverts to a view of the Record cache with no filtering applied.

Available since: 1.1.0

Parameters

  • suppressEvent : Boolean (optional)

    True to clear silently without firing the refresh event.

    Defaults to: false

Removes all listeners for this object. ...

Removes all listeners for this object.

Available since: 1.1.0

...

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( )private
...

Available since: 2.0.0

...

Available since: 2.0.0

Parameters

Creates an event handling function which refires the event from this object as the passed event name. ...

Creates an event handling function which refires the event from this object as the passed event name.

Available since: 2.0.0

Parameters

Returns

Ext.data.Store
view source
( )private
...

Available since: 1.1.0

Overrides: Ext.mixin.Observable.destroy

( name, fn, scope, options )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( store, data, operation )private
...

Available since: 2.0.0

Parameters

( eventName, args, action, connectedController )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( silent )private
...

Available since: 2.0.0

Parameters

( name, fn, scope, options, order )private
...

Available since: 2.0.0

Parameters

( me, value, oldValue, options )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( fn, [scope] )
Calls the specified function for each of the Records in the cache. ...

Calls the specified function for each of the Records in the cache.

Available since: 1.1.0

Parameters

  • fn : Function

    The function to call. The Record is passed as the first parameter. Returning false aborts and exits the iteration.

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to the current Record in the iteration.

Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if present. ...

Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if present. There is no implementation in the Observable base class.

Available since: 1.1.0

Parameters

  • events : String/String[]

    The event name to bubble, or an Array of event names.

Ext.data.Store
view source
( filters, [value], [anyMatch], [caseSensitive] )
Filters the loaded set of records by a given set of filters. ...

Filters the loaded set of records by a given set of filters.

Filtering by single field:

store.filter("email", /\.com$/);

Using multiple filters:

store.filter([
    {property: "email", value: /\.com$/},
    {filterFn: function(item) { return item.get("age") > 10; }}
]);

Using Ext.util.Filter instances instead of config objects (note that we need to specify the root config option in this case):

store.filter([
    Ext.create('Ext.util.Filter', {property: "email", value: /\.com$/, root: 'data'}),
    Ext.create('Ext.util.Filter', {filterFn: function(item) { return item.get("age") > 10; }, root: 'data'})
]);

If the remoteFilter configuration has been set to true, you will have to manually call the load method after you filter to retrieve the filtered data from the server.

Available since: 1.1.0

Parameters

  • filters : Object[]/Ext.util.Filter[]/String

    The set of filters to apply to the data. These are stored internally on the store, but the filtering itself is done on the Store's MixedCollection. See MixedCollection's filter method for filter syntax. Alternatively, pass in a property string.

  • value : String (optional)

    value to filter by (only if using a property string as the first argument).

  • anyMatch : Boolean (optional)

    True to allow any match, false to anchor regex beginning with ^.

    Defaults to: false

  • caseSensitive : Boolean (optional)

    True to make the filtering regex case sensitive.

    Defaults to: false

Ext.data.Store
view source
( fn, [scope] )
Filter by a function. ...

Filter by a function. The specified function will be called for each Record in this Store. If the function returns true the Record is included, otherwise it is filtered out.

Available since: 1.1.0

Parameters

  • fn : Function

    The function to be called. It will be passed the following parameters:

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to this Store.

Ext.data.Store
view source
( fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch] ) : Number
Finds the index of the first matching Record in this store by a specific field value. ...

Finds the index of the first matching Record in this store by a specific field value.

Available since: 1.1.0

Parameters

  • fieldName : String

    The name of the Record field to test.

  • value : String/RegExp

    Either a string that the field value should begin with, or a RegExp to test against the field.

  • startIndex : Number (optional)

    The index to start searching at

  • anyMatch : Boolean (optional)

    True to match any part of the string, not just the beginning

  • caseSensitive : Boolean (optional)

    True for case sensitive comparison

  • exactMatch : Boolean (optional)

    True to force exact match (^ and $ characters added to the regex). Defaults to false.

Returns

  • Number

    The matched index or -1

Ext.data.Store
view source
( fn, [scope], [startIndex] ) : Number
Find the index of the first matching Record in this Store by a function. ...

Find the index of the first matching Record in this Store by a function. If the function returns true it is considered a match.

Available since: 1.1.0

Parameters

  • fn : Function

    The function to be called. It will be passed the following parameters:

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to this Store.

  • startIndex : Number (optional)

    The index to start searching at

Returns

  • Number

    The matched index or -1

Ext.data.Store
view source
( fieldName, value, [startIndex] ) : Number
Finds the index of the first matching Record in this store by a specific field value. ...

Finds the index of the first matching Record in this store by a specific field value.

Available since: 1.1.0

Parameters

  • fieldName : String

    The name of the Record field to test.

  • value : Object

    The value to match the field against.

  • startIndex : Number (optional)

    The index to start searching at

Returns

  • Number

    The matched index or -1

Ext.data.Store
view source
( fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch] ) : Ext.data.Model
Finds the first matching Record in this store by a specific field value. ...

Finds the first matching Record in this store by a specific field value.

Available since: 1.1.0

Parameters

  • fieldName : String

    The name of the Record field to test.

  • value : String/RegExp

    Either a string that the field value should begin with, or a RegExp to test against the field.

  • startIndex : Number (optional)

    The index to start searching at

  • anyMatch : Boolean (optional)

    True to match any part of the string, not just the beginning

  • caseSensitive : Boolean (optional)

    True for case sensitive comparison

  • exactMatch : Boolean (optional)

    True to force exact match (^ and $ characters added to the regex). Defaults to false.

Returns

( eventName, args, fn, scope )
Fires the specified event with the passed parameters and execute a function (action) at the end if there are no liste...

Fires the specified event with the passed parameters and execute a function (action) at the end if there are no listeners that return false.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event to fire.

  • args : Array

    Arguments to pass to handers

  • fn : Function

    Action

  • scope : Object

    scope of fn

Fires the specified event with the passed parameters (minus the event name, plus the options object passed to addList...

Fires the specified event with the passed parameters (minus the event name, plus the options object passed to addListener).

The first argument is the name of the event. Every other argument passed will be available when you listen for the event.

Example

Firstly, we set up a listener for our new event.

this.on('myevent', function(arg1, arg2, arg3, arg4, options, e) {
    console.log(arg1); // true
    console.log(arg2); // 2
    console.log(arg3); // { test: 'foo' }
    console.log(arg4); // 14
    console.log(options); // the options added when adding the listener
    console.log(e); // the event object with information about the event
});

And then we can fire off the event.

this.fireEvent('myevent', true, 2, { test: 'foo' }, 14);

An event may be set to bubble up an Observable parent hierarchy by calling enableBubble.

Available since: 1.1.0

Parameters

  • eventName : String

    The name of the event to fire.

  • args : Object...

    Variable number of parameters are passed to handlers.

Returns

  • Boolean

    returns false if any of the handlers return false otherwise it returns true.

Ext.data.Store
view source
( ) : Ext.data.Model/undefined
Convenience function for getting the first model instance in the store ...

Convenience function for getting the first model instance in the store

Available since: 1.1.0

Returns

  • Ext.data.Model/undefined

    The first model instance in the store, or undefined

Ext.data.Store
view source
( ) : Number
Gets the number of all cached records including the ones currently filtered If using paging, this may not be the tota...

Gets the number of all cached records including the ones currently filtered If using paging, this may not be the total size of the dataset.

Available since: Touch 2.0.2

Returns

  • Number

    The number of all Records in the Store's cache.

Ext.data.Store
view source
( index ) : Ext.data.Model
Get the Record at the specified index. ...

Get the Record at the specified index.

Available since: 1.1.0

Parameters

  • index : Number

    The index of the Record to find.

Returns

  • Ext.data.Model

    The Record at the passed index. Returns undefined if not found.

Ext.data.Store
view source
( ) : Booleanprivate
Returns the value of autoDestroy. ...

Returns the value of autoDestroy.

Available since: 2.0.0

Returns

Returns the value of autoLoad. ...

Returns the value of autoLoad.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : Boolean
Returns the value of autoSync. ...

Returns the value of autoSync.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : Objectprivate
Returns an object which is passed in as the listeners argument to proxy.batch inside this.sync. ...

Returns an object which is passed in as the listeners argument to proxy.batch inside this.sync. This is broken out into a separate function to allow for customisation of the listeners

Available since: 1.1.0

Returns

Returns the value of bubbleEvents. ...

Returns the value of bubbleEvents.

Available since: 2.0.0

Returns

...

Available since: 2.0.0

Ext.data.Store
view source
( id ) : Ext.data.Model
Get the Record with the specified id. ...

Get the Record with the specified id.

Available since: 1.1.0

Parameters

  • id : String

    The id of the Record to find.

Returns

  • Ext.data.Model

    The Record with the passed id. Returns undefined if not found.

Returns the value of clearOnPageLoad. ...

Returns the value of clearOnPageLoad.

Available since: 2.0.0

Returns

...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( ) : Number
Gets the number of cached records. ...

Gets the number of cached records. Note that filtered records are not included in this count If using paging, this may not be the total size of the dataset.

Available since: 1.1.0

Returns

  • Number

    The number of Records in the Store's cache.

...

Available since: 2.0.0

Returns the value of data. ...

Returns the value of data.

Available since: 2.0.0

Returns

Returns the value of destroyRemovedRecords. ...

Returns the value of destroyRemovedRecords.

Available since: 2.0.1

Returns

...

Available since: 2.0.0

Ext.data.Store
view source
( ) : Object[]
Returns the value of fields. ...

Returns the value of fields.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( )private
...

Available since: 2.0.0

Ext.data.Store
view source
( ) : Functiondeprecated
Returns the value of getGroupString. ...

Returns the value of getGroupString.

This method has been deprecated

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : String
Returns the value of groupDir. ...

Returns the value of groupDir.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : String
Returns the value of groupField. ...

Returns the value of groupField.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( record )private
...

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( ) : Object[]
Returns the value of grouper. ...

Returns the value of grouper.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( [groupName] ) : Object/Object[]
Returns an array containing the result of applying the grouper to the records in this store. ...

Returns an array containing the result of applying the grouper to the records in this store. See groupField, groupDir and grouper. Example for a store containing records with a color field:

var myStore = Ext.create('Ext.data.Store', {
    groupField: 'color',
    groupDir  : 'DESC'
});

myStore.getGroups(); //returns:
[
   {
       name: 'yellow',
       children: [
           //all records where the color field is 'yellow'
       ]
   },
   {
       name: 'red',
       children: [
           //all records where the color field is 'red'
       ]
   }
]

Available since: 1.1.0

Parameters

  • groupName : String (optional)

    Pass in an optional groupName argument to access a specific group as defined by grouper

Returns

Retrieves the id of this component. ...

Retrieves the id of this component. Will autogenerate an id if one has not already been set.

Available since: 2.0.0

Returns

Returns the initial configuration passed to constructor. ...

Returns the initial configuration passed to constructor.

Available since: 2.0.0

Parameters

  • name : String (optional)

    When supplied, value for particular configuration option is returned, otherwise the full config object is returned.

Returns

Returns the value of listeners. ...

Returns the value of listeners.

Available since: 2.0.0

Returns

...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( ) : String
Returns the value of model. ...

Returns the value of model.

Available since: 2.0.0

Returns

Returns the value of modelDefaults. ...

Returns the value of modelDefaults.

Available since: 2.0.0

Returns

Returns all Model instances that are either currently a phantom (e.g. ...

Returns all Model instances that are either currently a phantom (e.g. have no id), or have an ID but have not yet been saved on this Store (this happens when adding a non-phantom record from another Store into this one).

Available since: 1.1.0

Returns

...

Available since: 2.0.0

...

Available since: 2.0.0

...

Available since: 2.0.0

Ext.data.Store
view source
( ) : Number
Returns the value of pageSize. ...

Returns the value of pageSize.

Available since: 2.0.0

Returns

Returns the value of proxy. ...

Returns the value of proxy.

Available since: 1.1.0

Returns

Ext.data.Store
view source
( [startIndex], [endIndex] ) : Ext.data.Model[]
Returns a range of Records between specified indices. ...

Returns a range of Records between specified indices.

Available since: 1.1.0

Parameters

  • startIndex : Number (optional)

    The starting index (defaults to 0)

  • endIndex : Number (optional)

    The ending index (defaults to the last Record in the Store)

Returns

Returns the value of remoteFilter. ...

Returns the value of remoteFilter.

Available since: 2.0.0

Returns

Returns the value of remoteGroup. ...

Returns the value of remoteGroup.

Available since: 2.0.0

Returns

Returns the value of remoteSort. ...

Returns the value of remoteSort.

Available since: 2.0.0

Returns

Returns any records that have been removed from the store but not yet destroyed on the proxy. ...

Returns any records that have been removed from the store but not yet destroyed on the proxy.

Available since: 1.1.0

Returns

Ext.data.Store
view source
( )private
...

Available since: 2.0.0

Ext.data.Store
view source
( ) : String
Returns the value of storeId. ...

Returns the value of storeId.

Available since: 2.0.0

Returns

Returns the value of syncRemovedRecords. ...

Returns the value of syncRemovedRecords.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : Number
Returns the value of totalCount. ...

Returns the value of totalCount.

Available since: 2.0.0

Returns

...

Available since: 2.0.0

Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy. ...

Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy.

Available since: 1.1.0

Returns

...

Available since: 2.0.0

...

Available since: 2.0.0

Parameters

Checks to see if this object has any listeners for a specified event ...

Checks to see if this object has any listeners for a specified event

Available since: 1.1.0

Parameters

  • eventName : String

    The name of the event to check for

Returns

  • Boolean

    True if the event is being listened for, else false

Ext.data.Store
view source
( record ) : Number
Get the index within the cache of the passed Record. ...

Get the index within the cache of the passed Record.

Available since: 1.1.0

Parameters

Returns

  • Number

    The index of the passed Record. Returns -1 if not found.

Ext.data.Store
view source
( id ) : Number
Get the index within the cache of the Record with the passed id. ...

Get the index within the cache of the Record with the passed id.

Available since: 1.1.0

Parameters

  • id : String

    The id of the Record to find.

Returns

  • Number

    The index of the Record. Returns -1 if not found.

( instanceConfig ) : Objectchainableprotected
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'

Available since: 2.0.0

Parameters

Returns

  • Object

    mixins The mixin prototypes as key - value pairs

...

Available since: 2.0.0

Ext.data.Store
view source
( index, records )
Inserts Model instances into the Store at the given index and fires the add event. ...

Inserts Model instances into the Store at the given index and fires the add event. See also add.

Available since: 1.1.0

Parameters

Returns true if the Store is set to autoLoad or is a type which loads upon instantiation. ...

Returns true if the Store is set to autoLoad or is a type which loads upon instantiation.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( ) : Boolean
Returns true if this store is currently filtered ...

Returns true if this store is currently filtered

Available since: 1.1.0

Returns

Ext.data.Store
view source
( ) : Boolean
This method tells you if this store has a grouper defined on it. ...

This method tells you if this store has a grouper defined on it.

Available since: 2.0.0

Returns

  • Boolean

    true if this store has a grouper defined.

Ext.data.Store
view source
( ) : Boolean
Returns true if the Store has been loaded. ...

Returns true if the Store has been loaded.

Available since: 2.0.0

Returns

  • Boolean

    True if the Store has been loaded

Ext.data.Store
view source
( ) : Boolean
Returns true if the Store is currently performing a load operation ...

Returns true if the Store is currently performing a load operation

Available since: 1.1.0

Returns

  • Boolean

    True if the Store is currently loading

Ext.data.Store
view source
( ) : Boolean
Returns true if this store is currently sorted ...

Returns true if this store is currently sorted

Available since: Touch 2.0.2

Returns

Ext.data.Store
view source
( ) : Ext.data.Model/undefined
Convenience function for getting the last model instance in the store ...

Convenience function for getting the last model instance in the store

Available since: 1.1.0

Returns

  • Ext.data.Model/undefined

    The last model instance in the store, or undefined

Ext.data.Store
view source
( [options], [scope] )
Loads data into the Store via the configured proxy. ...

Loads data into the Store via the configured proxy. This uses the Proxy to make an asynchronous call to whatever storage backend the Proxy uses, automatically adding the retrieved instances into the Store and calling an optional callback if required. Example usage:

store.load({
    callback: function(records, operation, success) {
        // the operation object contains all of the details of the load operation
        console.log(records);
    },
    scope: this
});

If only the callback and scope options need to be specified, then one can call it simply like so:

store.load(function(records, operation, success) {
    console.log('loaded records');
}, this);

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( data, append )deprecated
Loads an array of data straight into the Store ...

Loads an array of data straight into the Store

This method has been deprecated since 2.0

Please use add or setData instead.

Available since: 1.1.0

Parameters

  • data : Ext.data.Model[]/Object[]

    Array of data to load. Any non-model instances will be cast into model instances first

  • append : Boolean

    True to add the records to the existing records in the store, false to remove the old ones first

Ext.data.Store
view source
( page, options )
Loads a given 'page' of data by setting the start and limit values appropriately. ...

Loads a given 'page' of data by setting the start and limit values appropriately. Internally this just causes a normal load operation, passing in calculated 'start' and 'limit' params

Available since: 1.1.0

Parameters

  • page : Number

    The number of the page to load

  • options : Object

    See options for load

Ext.data.Store
view source
( model ) : Ext.data.Model[]deprecated
Adds Model instance to the Store. ...

Adds Model instance to the Store. This method accepts either:

  • An array of Model instances or Model configuration objects.
  • Any number of Model instance or Model configuration object arguments.

The new Model instances will be added at the end of the existing collection.

Sample usage:

myStore.add({some: 'data2'}, {some: 'other data2'});

This method has been deprecated since 2.0.0

Please use add instead.

Available since: 1.1.0

Parameters

  • model : Ext.data.Model[]/Ext.data.Model...

    An array of Model instances or Model configuration objects, or variable number of Model instance or config arguments.

Returns

Ext.data.Store
view source
( field ) : Object
Gets the maximum value in the store. ...

Gets the maximum value in the store.

Available since: 2.0.0

Parameters

  • field : String

    The field in each record

Returns

  • Object

    The maximum value, if no items exist, undefined.

Ext.data.Store
view source
( field ) : Object
Gets the minimum value in the store. ...

Gets the minimum value in the store.

Available since: 2.0.0

Parameters

  • field : String

    The field in each record

Returns

  • Object

    The minimum value, if no items exist, undefined.

( object, eventName, [fn], [scope], [options] )deprecated
Alias for addManagedListener. ...

Alias for addManagedListener.

Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed.

This method has been deprecated since 2.0.0

This is now done automatically

Available since: 2.0.0

Parameters

  • object : Ext.mixin.Observable/HTMLElement

    The item to which to add a listener/listeners.

  • eventName : Object/String

    The event name, or an object containing event name properties.

  • fn : Function (optional)

    If the eventName parameter was an event name, this is the handler function.

  • scope : Object (optional)

    If the eventName parameter was an event name, this is the scope in which the handler function is executed.

  • options : Object (optional)

    If the eventName parameter was an event name, this is the addListener options.

( object, eventName, [fn], [scope] )deprecated
Alias for removeManagedListener. ...

Alias for removeManagedListener.

Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed.

This method has been deprecated since 2.0.0

This is now done automatically

Available since: 2.0.0

Parameters

  • object : Ext.mixin.Observable/HTMLElement

    The item to which to add a listener/listeners.

  • eventName : Object/String

    The event name, or an object containing event name properties.

  • fn : Function (optional)

    If the eventName parameter was an event name, this is the handler function.

  • scope : Object (optional)

    If the eventName parameter was an event name, this is the scope in which the handler function is executed.

Ext.data.Store
view source
( options )
Loads the next 'page' in the current data set ...

Loads the next 'page' in the current data set

Available since: 1.1.0

Parameters

( eventName, fn, [scope], [options], [order] )
Alias for addListener. ...

Alias for addListener.

Appends an event handler to this object. You can review the available handlers by looking at the 'events' section of the documentation for the component you are working with.

Combining Options

Using the options argument, it is possible to combine different types of listeners:

A delayed, one-time listener:

container.on('tap', this.handleTap, this, {
    single: true,
    delay: 100
});

Attaching multiple handlers in 1 call

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

container.on({
    tap  : this.onTap,
    swipe: this.onSwipe,

    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

container.on({
    tap  : { fn: this.onTap, scope: this, single: true },
    swipe: { fn: button.onSwipe, scope: button }
});

See the Events Guide for more.

Available since: 1.1.0

Parameters

  • eventName : String

    The name of the event to listen for. May also be an object who's property names are event names.

  • fn : Function

    The method the event invokes. Will be called with arguments given to fireEvent plus the options parameter described below.

  • scope : Object (optional)

    The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

  • options : Object (optional)

    An object containing handler configuration.

    This object may contain any of the following properties:

    • scope : Object

      The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

    • delay : Number

      The number of milliseconds to delay the invocation of the handler after the event fires.

    • single : Boolean

      True to add a handler to handle just the next firing of the event, and then remove itself.

    • order : String

      The order of when the listener should be added into the listener queue.

      If you set an order of before and the event you are listening to is preventable, you can return false and it will stop the event.

      Available options are before, current and after. Defaults to current.

    • buffer : Number

      Causes the handler to be delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.

    • element : String

      Allows you to add a listener onto a element of this component using the elements reference.

      Ext.create('Ext.Component', {
          listeners: {
              element: 'element',
              tap: function() {
                  console.log('element tap!');
              }
          }
      });
      

      All components have the element reference, which is the outer most element of the component. Ext.Container also has the innerElement element which contains all children. In most cases element is adequate.

    • delegate : String

      Uses Ext.ComponentQuery to delegate events to a specified query selector within this item.

      // Create a container with a two children; a button and a toolbar
      var container = Ext.create('Ext.Container', {
          items: [
              {
                 xtype: 'toolbar',
                 docked: 'top',
                 title: 'My Toolbar'
              },
              {
                 xtype: 'button',
                 text: 'My Button'
              }
          ]
      });
      
      container.on({
          // Ext.Buttons have an xtype of 'button', so we use that are a selector for our delegate
          delegate: 'button',
      
          tap: function() {
              alert('Button tapped!');
          }
      });
      
  • order : String (optional)

    The order of when the listener should be added into the listener queue. Possible values are before, current and after.

    Defaults to: 'current'

( eventName, fn, [scope], [options] )
Alias for addAfterListener. ...

Alias for addAfterListener.

Appends an after-event handler.

Same as addListener with order set to 'after'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event to listen for.

  • fn : Function

    The method the event invokes.

  • scope : Object (optional)

    The scope for fn.

  • options : Object (optional)

    An object containing handler configuration.

Ext.data.Store
view source
( batch )private
Attached as the 'complete' event listener to a proxy's Batch object. ...

Attached as the 'complete' event listener to a proxy's Batch object. Iterates over the batch operations and updates the Store's internal data MixedCollection.

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( batch, operation )private
...

Available since: 1.1.0

Parameters

( eventName, fn, [scope], [options] )
Alias for addBeforeListener. ...

Alias for addBeforeListener.

Appends a before-event handler. Returning false from the handler will stop the event.

Same as addListener with order set to 'before'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event to listen for.

  • fn : Function

    The method the event invokes.

  • scope : Object (optional)

    The scope for fn.

  • options : Object (optional)

    An object containing handler configuration.

Ext.data.Store
view source
( cls, data )private
...

Available since: 2.0.0

Parameters

Overrides: Ext.Evented.onClassExtended

( names, callback, scope )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( records, operation, success )private
These methods are now just template methods since updating the records etc is all taken care of by the operation itself. ...

These methods are now just template methods since updating the records etc is all taken care of by the operation itself.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( records, operation, success )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( data )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( operation )private
Called internally when a Proxy has completed a load request ...

Called internally when a Proxy has completed a load request

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( operation )private
Callback for any write Operation over the Proxy. ...

Callback for any write Operation over the Proxy. Updates the Store's MixedCollection to reflect the updates provided by the Proxy

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( records, operation, success )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( options )
Loads the previous 'page' in the current data set ...

Loads the previous 'page' in the current data set

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( fn, [scope] ) : Ext.util.MixedCollection
Query the cached records in this Store using a filtering function. ...

Query the cached records in this Store using a filtering function. The specified function will be called with each record in this Store. If the function returns true the record is included in the results.

Available since: 1.1.0

Parameters

  • fn : Function

    The function to be called. It will be passed the following parameters:

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to this Store.

Returns

...

Available since: 2.0.0

Parameters

Relays selected events from the specified Observable as if the events were fired by this. ...

Relays selected events from the specified Observable as if the events were fired by this.

Available since: 1.1.0

Parameters

  • object : Object

    The Observable whose events this object is to relay.

  • events : String/Array/Object

    Array of event names to relay.

Returns

Ext.data.Store
view source
( records )
Removes the given record from the Store, firing the 'removerecords' event passing all the instances that are removed. ...

Removes the given record from the Store, firing the 'removerecords' event passing all the instances that are removed.

Available since: 1.1.0

Parameters

( eventName, fn, [scope], [options] )
Removes a before-event handler. ...

Removes a before-event handler.

Same as removeListener with order set to 'after'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event the handler was associated with.

  • fn : Function

    The handler to remove.

  • scope : Object (optional)

    The scope originally specified for fn.

  • options : Object (optional)

    Extra options object.

Ext.data.Store
view source
( silent )
Remove all items from the store. ...

Remove all items from the store.

Available since: 1.1.0

Parameters

  • silent : Boolean

    Prevent the clear event from being fired.

Ext.data.Store
view source
( index )
Removes the model instance at the given index ...

Removes the model instance at the given index

Available since: 1.1.0

Parameters

  • index : Number

    The record index

( eventName, fn, [scope], [options] )
Removes a before-event handler. ...

Removes a before-event handler.

Same as removeListener with order set to 'before'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event the handler was associated with.

  • fn : Function

    The handler to remove.

  • scope : Object (optional)

    The scope originally specified for fn.

  • options : Object (optional)

    Extra options object.

( selector, name, fn, scope, order )private
...

Available since: 2.0.0

Parameters

( eventName, fn, [scope], [options], [order] )
Removes an event handler. ...

Removes an event handler.

Available since: 1.1.0

Parameters

  • eventName : String

    The type of event the handler was associated with.

  • fn : Function

    The handler to remove. This must be a reference to the function passed into the addListener call.

  • scope : Object (optional)

    The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to addListener or the listener will not be removed.

  • options : Object (optional)

    Extra options object. See addListener for details.

  • order : String (optional)

    The order of the listener to remove. Possible values are before, current and after.

    Defaults to: 'current'

( object, eventName, [fn], [scope] )deprecated
Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed. ...

Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed.

This method has been deprecated since 2.0

All listeners are now automatically managed where necessary. Simply use removeListener.

Available since: 1.1.0

Parameters

  • object : Ext.mixin.Observable/HTMLElement

    The item to which to add a listener/listeners.

  • eventName : Object/String

    The event name, or an object containing event name properties.

  • fn : Function (optional)

    If the eventName parameter was an event name, this is the handler function.

  • scope : Object (optional)

    If the eventName parameter was an event name, this is the scope in which the handler function is executed.

Resumes firing events (see suspendEvents). ...

Resumes firing events (see suspendEvents).

If events were suspended using the queueSuspended parameter, then all events fired during event suspension will be sent to any listeners now.

Available since: 1.1.0

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

Sets the value of autoDestroy.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( autoLoad )
Sets the value of autoLoad. ...

Sets the value of autoLoad.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( autoSync )
Sets the value of autoSync. ...

Sets the value of autoSync.

Available since: 2.0.0

Parameters

Sets the value of bubbleEvents. ...

Sets the value of bubbleEvents.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( clearOnPageLoad )
Sets the value of clearOnPageLoad. ...

Sets the value of clearOnPageLoad.

Available since: 2.0.0

Parameters

( config, applyIfNotSet ) : Ext.Basechainableprivate
...

Available since: 2.0.0

Parameters

Returns

Ext.data.Store
view source
( data )
Sets the value of data. ...

Sets the value of data.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( destroyRemovedRecords )
Sets the value of destroyRemovedRecords. ...

Sets the value of destroyRemovedRecords.

Available since: 2.0.1

Parameters

Ext.data.Store
view source
( fields )
Sets the value of fields. ...

Sets the value of fields.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( filters )
Sets the value of filters. ...

Sets the value of filters.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( getGroupString )deprecated
Sets the value of getGroupString. ...

Sets the value of getGroupString.

This method has been deprecated

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( groupDir )
Sets the value of groupDir. ...

Sets the value of groupDir.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( groupField )
Sets the value of groupField. ...

Sets the value of groupField.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( grouper )
Sets the value of grouper. ...

Sets the value of grouper.

Available since: 2.0.0

Parameters

...

Available since: 2.0.0

Parameters

Sets the value of listeners. ...

Sets the value of listeners.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( model )
Sets the value of model. ...

Sets the value of model.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( modelDefaults )
Sets the value of modelDefaults. ...

Sets the value of modelDefaults.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( pageSize )
Sets the value of pageSize. ...

Sets the value of pageSize.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( proxy )
Sets the value of proxy. ...

Sets the value of proxy.

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( remoteFilter )
Sets the value of remoteFilter. ...

Sets the value of remoteFilter.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( remoteGroup )
Sets the value of remoteGroup. ...

Sets the value of remoteGroup.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( remoteSort )
Sets the value of remoteSort. ...

Sets the value of remoteSort.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( sorters )
Sets the value of sorters. ...

Sets the value of sorters.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( storeId )
Sets the value of storeId. ...

Sets the value of storeId.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( syncRemovedRecords )
Sets the value of syncRemovedRecords. ...

Sets the value of syncRemovedRecords.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( totalCount )
Sets the value of totalCount. ...

Sets the value of totalCount.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( sorters, defaultDirection, [where] )
Sorts the data in the Store by one or more of its properties. ...

Sorts the data in the Store by one or more of its properties. Example usage:

// sort by a single field
myStore.sort('myField', 'DESC');

// sorting by multiple fields
myStore.sort([
    {
        property : 'age',
        direction: 'ASC'
    },
    {
        property : 'name',
        direction: 'DESC'
    }
]);

Internally, Store converts the passed arguments into an array of Ext.util.Sorter instances, and delegates the actual sorting to its internal Ext.util.Collection.

When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:

store.sort('myField');
store.sort('myField');

is equivalent to this code:

store.sort('myField', 'ASC');
store.sort('myField', 'DESC');

because Store handles the toggling automatically.

If the remoteSort configuration has been set to true, you will have to manually call the load method after you sort to retrieve the sorted data from the server.

Available since: 1.1.0

Parameters

  • sorters : String/Ext.util.Sorter[]

    Either a string name of one of the fields in this Store's configured Model, or an array of sorter configurations.

  • defaultDirection : String

    The default overall direction to sort the data by. Defaults to "ASC".

  • where : String (optional)

    This can be either 'prepend' or 'append'. If you leave this undefined it will clear the current sorters.

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

Available since: 2.0.0

Returns

Ext.data.Store
view source
( field ) : Number
Sums the value of property for each record between start and end and returns the result. ...

Sums the value of property for each record between start and end and returns the result.

Available since: 1.1.0

Parameters

  • field : String

    The field in each record

Returns

Suspends the firing of all events. ...

Suspends the firing of all events. (see resumeEvents)

Available since: 1.1.0

Parameters

  • queueSuspended : Boolean

    Pass as true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events.

Ext.data.Store
view source
( )
Synchronizes the Store with its Proxy. ...

Synchronizes the Store with its Proxy. This asks the Proxy to batch together any new, updated and deleted records in the store, updating the Store's internal representation of the records as each operation completes.

Available since: 1.1.0

( eventName, fn, [scope], [options], [order] )
Alias for removeListener. ...

Alias for removeListener.

Removes an event handler.

Available since: 1.1.0

Parameters

  • eventName : String

    The type of event the handler was associated with.

  • fn : Function

    The handler to remove. This must be a reference to the function passed into the addListener call.

  • scope : Object (optional)

    The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to addListener or the listener will not be removed.

  • options : Object (optional)

    Extra options object. See addListener for details.

  • order : String (optional)

    The order of the listener to remove. Possible values are before, current and after.

    Defaults to: 'current'

( eventName, fn, [scope], [options] )
Alias for removeAfterListener. ...

Alias for removeAfterListener.

Removes a before-event handler.

Same as removeListener with order set to 'after'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event the handler was associated with.

  • fn : Function

    The handler to remove.

  • scope : Object (optional)

    The scope originally specified for fn.

  • options : Object (optional)

    Extra options object.

( eventName, fn, [scope], [options] )
Alias for removeBeforeListener. ...

Alias for removeBeforeListener.

Removes a before-event handler.

Same as removeListener with order set to 'before'.

Available since: 2.0.0

Parameters

  • eventName : String

    The name of the event the handler was associated with.

  • fn : Function

    The handler to remove.

  • scope : Object (optional)

    The scope originally specified for fn.

  • options : Object (optional)

    Extra options object.

Ext.data.Store
view source
( autoLoad )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( filters )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( groupDir )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( groupField )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( grouper, oldGrouper )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( model )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( proxy )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( remoteFilter )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( remoteSort )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( )private
...

Available since: 2.0.0

Ext.data.Store
view source
( sorters )private
...

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( storeId, oldStoreId )private
...

Available since: 2.0.0

Parameters

Defined By

Static Methods

( config, fullMerge )privatestatic
...

Available since: 2.0.0

Parameters

( members )chainableprivatestatic
...

Available since: 2.0.0

Parameters

( name, member )chainableprivatestatic
...

Available since: 2.0.0

Parameters

( members )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.implement({
     meow: function() {
        alert('Meowww...');
     }
 });

 var kitty = new My.awesome.Cat;
 kitty.meow();

Available since: 2.0.0

Parameters

( 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() { ... };
});

Available since: 2.0.0

Parameters

Returns

( xtype )chainableprivatestatic
...

Available since: 2.0.0

Parameters

( fromClass, members ) : Ext.Basechainableprivatestatic
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 '$$$$$$$'

Available since: 2.0.0

Parameters

  • fromClass : Ext.Base

    The class to borrow members from

  • members : Array/String

    The names of the members to borrow

Returns

( args )privatestatic
...

Available since: 2.0.0

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.

Available since: 2.0.0

Returns

Ext.data.Store
view source
( store )privatestatic
...

Available since: 1.1.0

Parameters

( 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()

Available since: 2.0.0

Parameters

( parent )privatestatic
...

Available since: 2.0.0

Parameters

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'

Available since: 2.0.0

Returns

...

Available since: 2.0.0

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

Used internally by the mixins pre-processor

Available since: 2.0.0

Parameters

( fn, scope )chainableprivatestatic
...

Available since: 2.0.0

Parameters

( members ) : Ext.Basechainabledeprecatedstatic
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!");

        var instance = this.callParent(arguments);

        alert("Meeeeoooowwww");

        return instance;
    }
});

var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
                          // alerts "I'm a cat!"
                          // alerts "Meeeeoooowwww"

As of 4.1, direct use of this method is deprecated. Use Ext.define instead:

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

        var instance = this.callParent(arguments);

        alert("Meeeeoooowwww");

        return instance;
    }
});

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).

This method has been deprecated since 4.1.0

Please use Ext.define instead

Available since: 2.0.0

Parameters

  • members : Object

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

Returns

...

Available since: 2.0.0

Defined By

Events

Ext.data.Store
view source
( store, records, eOpts )
Fired when one or more new Model instances have been added to this Store. ...

Fired when one or more new Model instances have been added to this Store. You should listen for this event if you have to update a representation of the records in this store in your UI. If you need the indices of the records that were added please use the store.indexOf(record) method.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( store, operation, eOpts )
Fires before a request is made for a new data object. ...

Fires before a request is made for a new data object. If the beforeload handler returns false the load action will be canceled. Note that you should not listen for this event in order to refresh the data view. Use the refresh event for this instead.

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( options, eOpts )
Fired before a call to sync is executed. ...

Fired before a call to sync is executed. Return false from any listener to cancel the synv

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( this, eOpts )
Fired after the removeAll method is called. ...

Fired after the removeAll method is called. Note that you should not listen for this event in order to refresh the data view. Use the refresh event for this instead.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( this, records, successful, operation, eOpts )
Fires whenever records have been loaded into the store. ...

Fires whenever records have been loaded into the store. Note that you should not listen for this event in order to refresh the data view. Use the refresh event for this instead.

Available since: 1.1.0

Parameters

Ext.data.Store
view source
( this, data, eOpts )
Fires whenever the server has sent back new metadata to reconfigure the Reader. ...

Fires whenever the server has sent back new metadata to reconfigure the Reader.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( this, data, eOpts )
Fires whenever the records in the Store have changed in a way that your representation of the records need to be enti...

Fires whenever the records in the Store have changed in a way that your representation of the records need to be entirely refreshed.

Available since: 2.0.0

Parameters

Ext.data.Store
view source
( store, records, indices, eOpts )
Fired when one or more Model instances have been removed from this Store. ...

Fired when one or more Model instances have been removed from this Store. You should listen for this event if you have to update a representation of the records in this store in your UI.

Available since: 2.0.0

Parameters

  • store : Ext.data.Store

    The Store object

  • records : Ext.data.Model[]

    The Model instances that was removed

  • indices : Number[]

    The indices of the records that were removed. These indices already take into account any potential earlier records that you remove. This means that if you loop over the records, you can get its current index in your data representation from this array.

  • eOpts : Object

    The options object passed to Ext.util.Observable.addListener.

Ext.data.Store
view source
( this, record, newIndex, oldIndex, modifiedFieldNames, modifiedValues, eOpts )removed
Fires when a Model instance has been updated ...

Fires when a Model instance has been updated

This event has been removed since 2.0

Listen to updaterecord instead.

Available since: 1.1.0

Parameters

  • this : Ext.data.Store
  • record : Ext.data.Model

    The Model instance that was updated

  • newIndex : Number

    If the update changed the index of the record (due to sorting for example), then this gives you the new index in the store.

  • oldIndex : Number

    If the update changed the index of the record (due to sorting for example), then this gives you the old index in the store.

  • modifiedFieldNames : Array

    An array containing the field names that have been modified since the record was committed or created

  • modifiedValues : Object

    An object where each key represents a field name that had it's value modified, and where the value represents the old value for that field. To get the new value in a listener you should use the get method.

  • eOpts : Object

    The options object passed to Ext.util.Observable.addListener.

Ext.data.Store
view source
( this, record, newIndex, oldIndex, modifiedFieldNames, modifiedValues, eOpts )
Fires when a Model instance has been updated ...

Fires when a Model instance has been updated

Available since: 2.0.0

Parameters

  • this : Ext.data.Store
  • record : Ext.data.Model

    The Model instance that was updated

  • newIndex : Number

    If the update changed the index of the record (due to sorting for example), then this gives you the new index in the store.

  • oldIndex : Number

    If the update changed the index of the record (due to sorting for example), then this gives you the old index in the store.

  • modifiedFieldNames : Array

    An array containing the field names that have been modified since the record was committed or created

  • modifiedValues : Object

    An object where each key represents a field name that had it's value modified, and where the value represents the old value for that field. To get the new value in a listener you should use the get method.

  • eOpts : Object

    The options object passed to Ext.util.Observable.addListener.

Ext.data.Store
view source
( store, operation, eOpts )
Fires whenever a successful write has been made via the configured Proxy ...

Fires whenever a successful write has been made via the configured Proxy

Available since: 2.0.0

Parameters