Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / AbstractStore.html
index 00312c1..8ca035e 100644 (file)
@@ -1,4 +1,21 @@
-<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-data.AbstractStore'>/**
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>The source code</title>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js"><span id='Ext-data-AbstractStore'>/**
 </span> * @author Ed Spencer
  * @class Ext.data.AbstractStore
  *
@@ -48,25 +65,25 @@ Ext.define('Ext.data.AbstractStore', {
     remoteSort  : false,
     remoteFilter: false,
 
-<span id='Ext-data.AbstractStore-cfg-proxy'>    /**
+<span id='Ext-data-AbstractStore-cfg-proxy'>    /**
 </span>     * @cfg {String/Ext.data.proxy.Proxy/Object} proxy The Proxy to use for this Store. This can be either a string, a config
      * object or a Proxy instance - see {@link #setProxy} for details.
      */
 
-<span id='Ext-data.AbstractStore-cfg-autoLoad'>    /**
+<span id='Ext-data-AbstractStore-cfg-autoLoad'>    /**
 </span>     * @cfg {Boolean/Object} autoLoad 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.
      */
     autoLoad: false,
 
-<span id='Ext-data.AbstractStore-cfg-autoSync'>    /**
+<span id='Ext-data-AbstractStore-cfg-autoSync'>    /**
 </span>     * @cfg {Boolean} autoSync True to automatically sync the Store with its Proxy after every edit to one of its Records.
      * Defaults to false.
      */
     autoSync: false,
 
-<span id='Ext-data.AbstractStore-property-batchUpdateMode'>    /**
+<span id='Ext-data-AbstractStore-property-batchUpdateMode'>    /**
 </span>     * Sets the updating behavior based on batch synchronization. 'operation' (the default) will update the Store's
      * internal representation of the data after each operation of the batch has completed, 'complete' will wait until
      * the entire batch has been completed before updating the Store's data. 'complete' is a good choice for local
@@ -76,7 +93,7 @@ Ext.define('Ext.data.AbstractStore', {
      */
     batchUpdateMode: 'operation',
 
-<span id='Ext-data.AbstractStore-property-filterOnLoad'>    /**
+<span id='Ext-data-AbstractStore-property-filterOnLoad'>    /**
 </span>     * If true, any filters attached to this Store will be run after loading data, before the datachanged event is fired.
      * Defaults to true, ignored if {@link #remoteFilter} is true
      * @property filterOnLoad
@@ -84,7 +101,7 @@ Ext.define('Ext.data.AbstractStore', {
      */
     filterOnLoad: true,
 
-<span id='Ext-data.AbstractStore-property-sortOnLoad'>    /**
+<span id='Ext-data-AbstractStore-property-sortOnLoad'>    /**
 </span>     * If true, any sorters attached to this Store will be run after loading data, before the datachanged event is fired.
      * Defaults to true, igored if {@link #remoteSort} is true
      * @property sortOnLoad
@@ -92,7 +109,7 @@ Ext.define('Ext.data.AbstractStore', {
      */
     sortOnLoad: true,
 
-<span id='Ext-data.AbstractStore-property-implicitModel'>    /**
+<span id='Ext-data-AbstractStore-property-implicitModel'>    /**
 </span>     * True if a model was created implicitly for this Store. This happens if a fields array is passed to the Store's constructor
      * instead of a model constructor or name.
      * @property implicitModel
@@ -101,14 +118,14 @@ Ext.define('Ext.data.AbstractStore', {
      */
     implicitModel: false,
 
-<span id='Ext-data.AbstractStore-property-defaultProxyType'>    /**
+<span id='Ext-data-AbstractStore-property-defaultProxyType'>    /**
 </span>     * The string type of the Proxy to create if none is specified. This defaults to creating a {@link Ext.data.proxy.Memory memory proxy}.
      * @property defaultProxyType
      * @type String
      */
     defaultProxyType: 'memory',
 
-<span id='Ext-data.AbstractStore-property-isDestroyed'>    /**
+<span id='Ext-data-AbstractStore-property-isDestroyed'>    /**
 </span>     * True if the Store has already been destroyed via {@link #destroyStore}. If this is true, the reference to Store should be deleted
      * as it will not function correctly any more.
      * @property isDestroyed
@@ -118,12 +135,12 @@ Ext.define('Ext.data.AbstractStore', {
 
     isStore: true,
 
-<span id='Ext-data.AbstractStore-cfg-storeId'>    /**
+<span id='Ext-data-AbstractStore-cfg-storeId'>    /**
 </span>     * @cfg {String} storeId Optional unique identifier for this store. If present, this Store will be registered with 
      * the {@link Ext.data.StoreManager}, making it easy to reuse elsewhere. Defaults to undefined.
      */
     
-<span id='Ext-data.AbstractStore-cfg-fields'>    /**
+<span id='Ext-data-AbstractStore-cfg-fields'>    /**
 </span>     * @cfg {Array} fields
      * This may be used in place of specifying a {@link #model} configuration. The fields should be a 
      * set of {@link Ext.data.Field} configuration objects. The store will automatically create a {@link Ext.data.Model}
@@ -136,10 +153,11 @@ Ext.define('Ext.data.AbstractStore', {
     
     //documented above
     constructor: function(config) {
-        var me = this;
+        var me = this,
+            filters;
         
         me.addEvents(
-<span id='Ext-data.AbstractStore-event-add'>            /**
+<span id='Ext-data-AbstractStore-event-add'>            /**
 </span>             * @event add
              * Fired when a Model instance has been added to this Store
              * @param {Ext.data.Store} store The store
@@ -148,7 +166,7 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'add',
 
-<span id='Ext-data.AbstractStore-event-remove'>            /**
+<span id='Ext-data-AbstractStore-event-remove'>            /**
 </span>             * @event remove
              * Fired when a Model instance has been removed from this Store
              * @param {Ext.data.Store} store The Store object
@@ -157,7 +175,7 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'remove',
             
-<span id='Ext-data.AbstractStore-event-update'>            /**
+<span id='Ext-data-AbstractStore-event-update'>            /**
 </span>             * @event update
              * Fires when a Record has been updated
              * @param {Store} this
@@ -171,7 +189,7 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'update',
 
-<span id='Ext-data.AbstractStore-event-datachanged'>            /**
+<span id='Ext-data-AbstractStore-event-datachanged'>            /**
 </span>             * @event datachanged
              * Fires whenever the records in the Store have changed in some way - this could include adding or removing records,
              * or updating the data in existing records
@@ -179,7 +197,7 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'datachanged',
 
-<span id='Ext-data.AbstractStore-event-beforeload'>            /**
+<span id='Ext-data-AbstractStore-event-beforeload'>            /**
 </span>             * @event beforeload
              * Event description
              * @param {Ext.data.Store} store This Store
@@ -187,7 +205,7 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'beforeload',
 
-<span id='Ext-data.AbstractStore-event-load'>            /**
+<span id='Ext-data-AbstractStore-event-load'>            /**
 </span>             * @event load
              * Fires whenever the store reads data from a remote data source.
              * @param {Ext.data.Store} this
@@ -196,13 +214,13 @@ Ext.define('Ext.data.AbstractStore', {
              */
             'load',
 
-<span id='Ext-data.AbstractStore-event-beforesync'>            /**
+<span id='Ext-data-AbstractStore-event-beforesync'>            /**
 </span>             * @event beforesync
              * Called before a call to {@link #sync} is executed. Return false from any listener to cancel the synv
              * @param {Object} options Hash of all records to be synchronized, broken down into create, update and destroy
              */
             'beforesync',
-<span id='Ext-data.AbstractStore-event-clear'>            /**
+<span id='Ext-data-AbstractStore-event-clear'>            /**
 </span>             * @event clear
              * Fired after the {@link #removeAll} method is called.
              * @param {Ext.data.Store} this
@@ -211,8 +229,9 @@ Ext.define('Ext.data.AbstractStore', {
         );
         
         Ext.apply(me, config);
+        // don't use *config* anymore from here on... use *me* instead...
 
-<span id='Ext-data.AbstractStore-property-removed'>        /**
+<span id='Ext-data-AbstractStore-property-removed'>        /**
 </span>         * Temporary cache in which removed model instances are kept until successfully synchronised with a Proxy,
          * at which point this is cleared.
          * @private
@@ -222,9 +241,9 @@ Ext.define('Ext.data.AbstractStore', {
         me.removed = [];
 
         me.mixins.observable.constructor.apply(me, arguments);
-        me.model = Ext.ModelManager.getModel(config.model || me.model);
+        me.model = Ext.ModelManager.getModel(me.model);
 
-<span id='Ext-data.AbstractStore-property-modelDefaults'>        /**
+<span id='Ext-data-AbstractStore-property-modelDefaults'>        /**
 </span>         * @property modelDefaults
          * @type Object
          * @private
@@ -250,7 +269,7 @@ Ext.define('Ext.data.AbstractStore', {
         }
 
         //ensures that the Proxy is instantiated correctly
-        me.setProxy(config.proxy || me.proxy || me.model.getProxy());
+        me.setProxy(me.proxy || me.model.getProxy());
 
         if (me.id &amp;&amp; !me.storeId) {
             me.storeId = me.id;
@@ -263,16 +282,17 @@ Ext.define('Ext.data.AbstractStore', {
         
         me.mixins.sortable.initSortable.call(me);        
         
-<span id='Ext-data.AbstractStore-property-filters'>        /**
+<span id='Ext-data-AbstractStore-property-filters'>        /**
 </span>         * The collection of {@link Ext.util.Filter Filters} currently applied to this Store
          * @property filters
          * @type Ext.util.MixedCollection
          */
+        filters = me.decodeFilters(me.filters);
         me.filters = Ext.create('Ext.util.MixedCollection');
-        me.filters.addAll(me.decodeFilters(config.filters));
+        me.filters.addAll(filters);
     },
 
-<span id='Ext-data.AbstractStore-method-setProxy'>    /**
+<span id='Ext-data-AbstractStore-method-setProxy'>    /**
 </span>     * Sets the Store's Proxy by string, config object or Proxy instance
      * @param {String|Object|Ext.data.proxy.Proxy} proxy The new Proxy, which can be either a type string, a configuration object
      * or an Ext.data.proxy.Proxy instance
@@ -301,7 +321,7 @@ Ext.define('Ext.data.AbstractStore', {
         return me.proxy;
     },
 
-<span id='Ext-data.AbstractStore-method-getProxy'>    /**
+<span id='Ext-data-AbstractStore-method-getProxy'>    /**
 </span>     * Returns the proxy currently attached to this proxy instance
      * @return {Ext.data.proxy.Proxy} The Proxy instance
      */
@@ -350,7 +370,7 @@ Ext.define('Ext.data.AbstractStore', {
         return me.proxy.update(operation, me.onProxyWrite, me);
     },
 
-<span id='Ext-data.AbstractStore-method-onProxyWrite'>    /**
+<span id='Ext-data-AbstractStore-method-onProxyWrite'>    /**
 </span>     * @private
      * Callback for any write Operation over the Proxy. Updates the Store's MixedCollection to reflect
      * the updates provided by the Proxy
@@ -398,7 +418,7 @@ Ext.define('Ext.data.AbstractStore', {
         return me.proxy.destroy(operation, me.onProxyWrite, me);
     },
 
-<span id='Ext-data.AbstractStore-method-onBatchOperationComplete'>    /**
+<span id='Ext-data-AbstractStore-method-onBatchOperationComplete'>    /**
 </span>     * @private
      * Attached as the 'operationcomplete' event listener to a proxy's Batch object. By default just calls through
      * to onProxyWrite.
@@ -407,7 +427,7 @@ Ext.define('Ext.data.AbstractStore', {
         return this.onProxyWrite(operation);
     },
 
-<span id='Ext-data.AbstractStore-method-onBatchComplete'>    /**
+<span id='Ext-data-AbstractStore-method-onBatchComplete'>    /**
 </span>     * @private
      * 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.
@@ -437,7 +457,7 @@ Ext.define('Ext.data.AbstractStore', {
         // batch.retry();
     },
 
-<span id='Ext-data.AbstractStore-method-filterNew'>    /**
+<span id='Ext-data-AbstractStore-method-filterNew'>    /**
 </span>     * @private
      * Filter function for new records.
      */
@@ -446,7 +466,7 @@ Ext.define('Ext.data.AbstractStore', {
         return item.phantom === true &amp;&amp; item.isValid();
     },
 
-<span id='Ext-data.AbstractStore-method-getNewRecords'>    /**
+<span id='Ext-data-AbstractStore-method-getNewRecords'>    /**
 </span>     * 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)
      * @return {Array} The Model instances
@@ -455,7 +475,7 @@ Ext.define('Ext.data.AbstractStore', {
         return [];
     },
 
-<span id='Ext-data.AbstractStore-method-getUpdatedRecords'>    /**
+<span id='Ext-data-AbstractStore-method-getUpdatedRecords'>    /**
 </span>     * Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy
      * @return {Array} The updated Model instances
      */
@@ -463,7 +483,7 @@ Ext.define('Ext.data.AbstractStore', {
         return [];
     },
 
-<span id='Ext-data.AbstractStore-method-filterUpdated'>    /**
+<span id='Ext-data-AbstractStore-method-filterUpdated'>    /**
 </span>     * @private
      * Filter function for updated records.
      */
@@ -472,7 +492,10 @@ Ext.define('Ext.data.AbstractStore', {
         return item.dirty === true &amp;&amp; item.phantom !== true &amp;&amp; item.isValid();
     },
 
-    //returns any records that have been removed from the store but not yet destroyed on the proxy
+<span id='Ext-data-AbstractStore-method-getRemovedRecords'>    /**
+</span>     * Returns any records that have been removed from the store but not yet destroyed on the proxy.
+     * @return {Array} The removed Model instances
+     */
     getRemovedRecords: function() {
         return this.removed;
     },
@@ -481,7 +504,7 @@ Ext.define('Ext.data.AbstractStore', {
 
     },
 
-<span id='Ext-data.AbstractStore-method-decodeFilters'>    /**
+<span id='Ext-data-AbstractStore-method-decodeFilters'>    /**
 </span>     * @private
      * Normalizes an array of filter objects, ensuring that they are all Ext.util.Filter instances
      * @param {Array} filters The filters array
@@ -539,7 +562,7 @@ Ext.define('Ext.data.AbstractStore', {
 
     },
     
-<span id='Ext-data.AbstractStore-method-sync'>    /**
+<span id='Ext-data-AbstractStore-method-sync'>    /**
 </span>     * 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.
@@ -573,7 +596,7 @@ Ext.define('Ext.data.AbstractStore', {
     },
 
 
-<span id='Ext-data.AbstractStore-method-getBatchListeners'>    /**
+<span id='Ext-data-AbstractStore-method-getBatchListeners'>    /**
 </span>     * @private
      * 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
@@ -600,7 +623,7 @@ Ext.define('Ext.data.AbstractStore', {
         return this.sync.apply(this, arguments);
     },
 
-<span id='Ext-data.AbstractStore-method-load'>    /**
+<span id='Ext-data-AbstractStore-method-load'>    /**
 </span>     * Loads the Store using its configured {@link #proxy}.
      * @param {Object} options Optional config object. This is passed into the {@link Ext.data.Operation Operation}
      * object that is created and then sent to the proxy's {@link Ext.data.proxy.Proxy#read} function
@@ -627,7 +650,7 @@ Ext.define('Ext.data.AbstractStore', {
         return me;
     },
 
-<span id='Ext-data.AbstractStore-method-afterEdit'>    /**
+<span id='Ext-data-AbstractStore-method-afterEdit'>    /**
 </span>     * @private
      * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to.
      * @param {Ext.data.Model} record The model instance that was edited
@@ -642,7 +665,7 @@ Ext.define('Ext.data.AbstractStore', {
         me.fireEvent('update', me, record, Ext.data.Model.EDIT);
     },
 
-<span id='Ext-data.AbstractStore-method-afterReject'>    /**
+<span id='Ext-data-AbstractStore-method-afterReject'>    /**
 </span>     * @private
      * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to..
      * @param {Ext.data.Model} record The model instance that was edited
@@ -651,7 +674,7 @@ Ext.define('Ext.data.AbstractStore', {
         this.fireEvent('update', this, record, Ext.data.Model.REJECT);
     },
 
-<span id='Ext-data.AbstractStore-method-afterCommit'>    /**
+<span id='Ext-data-AbstractStore-method-afterCommit'>    /**
 </span>     * @private
      * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to.
      * @param {Ext.data.Model} record The model instance that was edited
@@ -698,16 +721,17 @@ Ext.define('Ext.data.AbstractStore', {
 
     getById: Ext.emptyFn,
     
-<span id='Ext-data.AbstractStore-property-removeAll'>    /**
+<span id='Ext-data-AbstractStore-method-removeAll'>    /**
 </span>     * Removes all records from the store. This method does a &quot;fast remove&quot;,
      * individual remove events are not called. The {@link #clear} event is
      * fired upon completion.
+     * @method
      */
     removeAll: Ext.emptyFn,
     // individual substores should implement a &quot;fast&quot; remove
     // and fire a clear event afterwards
 
-<span id='Ext-data.AbstractStore-method-isLoading'>    /**
+<span id='Ext-data-AbstractStore-method-isLoading'>    /**
 </span>     * Returns true if the Store is currently performing a load operation
      * @return {Boolean} True if the Store is currently loading
      */
@@ -715,4 +739,6 @@ Ext.define('Ext.data.AbstractStore', {
         return this.loading;
      }
 });
-</pre></pre></body></html>
\ No newline at end of file
+</pre>
+</body>
+</html>