+ <div id="prop-Ext.data.Store-isDestroyed"></div>/**
+ * @property isDestroyed
+ * @type Boolean
+ * True if the store has been destroyed already. Read only
+ */
+ isDestroyed: false,
+
+ <div id="prop-Ext.data.Store-hasMultiSort"></div>/**
+ * @property hasMultiSort
+ * @type Boolean
+ * True if this store is currently sorted by more than one field/direction combination.
+ */
+ hasMultiSort: false,
+
+ // private
+ batchKey : '_ext_batch_',
+
+ constructor : function(config){
+ this.data = new Ext.util.MixedCollection(false);
+ this.data.getKey = function(o){
+ return o.id;
+ };
+
+
+ // temporary removed-records cache
+ this.removed = [];
+
+ if(config && config.data){
+ this.inlineData = config.data;
+ delete config.data;
+ }
+
+ Ext.apply(this, config);
+
+ <div id="prop-Ext.data.Store-baseParams"></div>/**
+ * See the <code>{@link #baseParams corresponding configuration option}</code>
+ * for a description of this property.
+ * To modify this property see <code>{@link #setBaseParam}</code>.
+ * @property
+ */
+ this.baseParams = Ext.isObject(this.baseParams) ? this.baseParams : {};
+
+ this.paramNames = Ext.applyIf(this.paramNames || {}, this.defaultParamNames);
+
+ if((this.url || this.api) && !this.proxy){
+ this.proxy = new Ext.data.HttpProxy({url: this.url, api: this.api});
+ }
+ // If Store is RESTful, so too is the DataProxy
+ if (this.restful === true && this.proxy) {
+ // When operating RESTfully, a unique transaction is generated for each record.
+ // TODO might want to allow implemention of faux REST where batch is possible using RESTful routes only.
+ this.batch = false;
+ Ext.data.Api.restify(this.proxy);
+ }
+
+ if(this.reader){ // reader passed
+ if(!this.recordType){
+ this.recordType = this.reader.recordType;
+ }
+ if(this.reader.onMetaChange){
+ this.reader.onMetaChange = this.reader.onMetaChange.createSequence(this.onMetaChange, this);
+ }
+ if (this.writer) { // writer passed
+ if (this.writer instanceof(Ext.data.DataWriter) === false) { // <-- config-object instead of instance.
+ this.writer = this.buildWriter(this.writer);
+ }
+ this.writer.meta = this.reader.meta;
+ this.pruneModifiedRecords = true;
+ }
+ }
+
+ <div id="prop-Ext.data.Store-recordType"></div>/**
+ * The {@link Ext.data.Record Record} constructor as supplied to (or created by) the
+ * {@link Ext.data.DataReader Reader}. Read-only.
+ * <p>If the Reader was constructed by passing in an Array of {@link Ext.data.Field} definition objects,
+ * instead of a Record constructor, it will implicitly create a Record constructor from that Array (see
+ * {@link Ext.data.Record}.{@link Ext.data.Record#create create} for additional details).</p>
+ * <p>This property may be used to create new Records of the type held in this Store, for example:</p><pre><code>
+ // create the data store
+ var store = new Ext.data.ArrayStore({
+ autoDestroy: true,
+ fields: [
+ {name: 'company'},
+ {name: 'price', type: 'float'},
+ {name: 'change', type: 'float'},
+ {name: 'pctChange', type: 'float'},
+ {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
+ ]
+ });
+ store.loadData(myData);
+
+ // create the Grid
+ var grid = new Ext.grid.EditorGridPanel({
+ store: store,
+ colModel: new Ext.grid.ColumnModel({
+ columns: [
+ {id:'company', header: 'Company', width: 160, dataIndex: 'company'},
+ {header: 'Price', renderer: 'usMoney', dataIndex: 'price'},
+ {header: 'Change', renderer: change, dataIndex: 'change'},
+ {header: '% Change', renderer: pctChange, dataIndex: 'pctChange'},
+ {header: 'Last Updated', width: 85,
+ renderer: Ext.util.Format.dateRenderer('m/d/Y'),
+ dataIndex: 'lastChange'}
+ ],
+ defaults: {
+ sortable: true,
+ width: 75
+ }
+ }),
+ autoExpandColumn: 'company', // match the id specified in the column model
+ height:350,
+ width:600,
+ title:'Array Grid',
+ tbar: [{
+ text: 'Add Record',
+ handler : function(){
+ var defaultData = {
+ change: 0,
+ company: 'New Company',
+ lastChange: (new Date()).clearTime(),
+ pctChange: 0,
+ price: 10
+ };
+ var recId = 3; // provide unique id
+ var p = new store.recordType(defaultData, recId); // create new record
+ grid.stopEditing();
+ store.{@link #insert}(0, p); // insert a new record into the store (also see {@link #add})
+ grid.startEditing(0, 0);
+ }
+ }]
+ });
+ * </code></pre>
+ * @property recordType
+ * @type Function
+ */
+
+ if(this.recordType){
+ <div id="prop-Ext.data.Store-fields"></div>/**
+ * A {@link Ext.util.MixedCollection MixedCollection} containing the defined {@link Ext.data.Field Field}s
+ * for the {@link Ext.data.Record Records} stored in this Store. Read-only.
+ * @property fields
+ * @type Ext.util.MixedCollection
+ */
+ this.fields = this.recordType.prototype.fields;
+ }
+ this.modified = [];
+
+ this.addEvents(
+ <div id="event-Ext.data.Store-datachanged"></div>/**
+ * @event datachanged
+ * Fires when the data cache has changed in a bulk manner (e.g., it has been sorted, filtered, etc.) and a
+ * widget that is using this Store as a Record cache should refresh its view.
+ * @param {Store} this
+ */
+ 'datachanged',
+ <div id="event-Ext.data.Store-metachange"></div>/**
+ * @event metachange
+ * Fires when this store's reader provides new metadata (fields). This is currently only supported for JsonReaders.
+ * @param {Store} this
+ * @param {Object} meta The JSON metadata
+ */
+ 'metachange',
+ <div id="event-Ext.data.Store-add"></div>/**
+ * @event add
+ * Fires when Records have been {@link #add}ed to the Store
+ * @param {Store} this
+ * @param {Ext.data.Record[]} records The array of Records added
+ * @param {Number} index The index at which the record(s) were added
+ */
+ 'add',
+ <div id="event-Ext.data.Store-remove"></div>/**
+ * @event remove
+ * Fires when a Record has been {@link #remove}d from the Store
+ * @param {Store} this
+ * @param {Ext.data.Record} record The Record that was removed
+ * @param {Number} index The index at which the record was removed
+ */
+ 'remove',
+ <div id="event-Ext.data.Store-update"></div>/**
+ * @event update
+ * Fires when a Record has been updated
+ * @param {Store} this
+ * @param {Ext.data.Record} record The Record that was updated
+ * @param {String} operation The update operation being performed. Value may be one of:
+ * <pre><code>
+ Ext.data.Record.EDIT
+ Ext.data.Record.REJECT
+ Ext.data.Record.COMMIT
+ * </code></pre>
+ */
+ 'update',
+ <div id="event-Ext.data.Store-clear"></div>/**
+ * @event clear
+ * Fires when the data cache has been cleared.
+ * @param {Store} this
+ * @param {Record[]} The records that were cleared.
+ */
+ 'clear',
+ <div id="event-Ext.data.Store-exception"></div>/**
+ * @event exception
+ * <p>Fires if an exception occurs in the Proxy during a remote request.
+ * This event is relayed through the corresponding {@link Ext.data.DataProxy}.
+ * See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
+ * for additional details.
+ * @param {misc} misc See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
+ * for description.
+ */
+ 'exception',
+ <div id="event-Ext.data.Store-beforeload"></div>/**
+ * @event beforeload
+ * Fires before a request is made for a new data object. If the beforeload handler returns
+ * <tt>false</tt> the {@link #load} action will be canceled.
+ * @param {Store} this
+ * @param {Object} options The loading options that were specified (see {@link #load} for details)
+ */
+ 'beforeload',
+ <div id="event-Ext.data.Store-load"></div>/**
+ * @event load
+ * Fires after a new set of Records has been loaded.
+ * @param {Store} this
+ * @param {Ext.data.Record[]} records The Records that were loaded
+ * @param {Object} options The loading options that were specified (see {@link #load} for details)
+ */
+ 'load',
+ <div id="event-Ext.data.Store-loadexception"></div>/**
+ * @event loadexception
+ * <p>This event is <b>deprecated</b> in favor of the catch-all <b><code>{@link #exception}</code></b>
+ * event instead.</p>
+ * <p>This event is relayed through the corresponding {@link Ext.data.DataProxy}.
+ * See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#loadexception loadexception}
+ * for additional details.
+ * @param {misc} misc See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#loadexception loadexception}
+ * for description.
+ */
+ 'loadexception',
+ <div id="event-Ext.data.Store-beforewrite"></div>/**
+ * @event beforewrite
+ * @param {Ext.data.Store} store
+ * @param {String} action [Ext.data.Api.actions.create|update|destroy]
+ * @param {Record/Record[]} rs The Record(s) being written.
+ * @param {Object} options The loading options that were specified. Edit <code>options.params</code> to add Http parameters to the request. (see {@link #save} for details)
+ * @param {Object} arg The callback's arg object passed to the {@link #request} function
+ */
+ 'beforewrite',
+ <div id="event-Ext.data.Store-write"></div>/**
+ * @event write
+ * Fires if the server returns 200 after an Ext.data.Api.actions CRUD action.
+ * Success of the action is determined in the <code>result['successProperty']</code>property (<b>NOTE</b> for RESTful stores,
+ * a simple 20x response is sufficient for the actions "destroy" and "update". The "create" action should should return 200 along with a database pk).
+ * @param {Ext.data.Store} store
+ * @param {String} action [Ext.data.Api.actions.create|update|destroy]
+ * @param {Object} result The 'data' picked-out out of the response for convenience.
+ * @param {Ext.Direct.Transaction} res
+ * @param {Record/Record[]} rs Store's records, the subject(s) of the write-action
+ */
+ 'write',
+ <div id="event-Ext.data.Store-beforesave"></div>/**
+ * @event beforesave
+ * Fires before a save action is called. A save encompasses destroying records, updating records and creating records.
+ * @param {Ext.data.Store} store
+ * @param {Object} data An object containing the data that is to be saved. The object will contain a key for each appropriate action,
+ * with an array of records for each action.
+ */
+ 'beforesave',
+ <div id="event-Ext.data.Store-save"></div>/**
+ * @event save
+ * Fires after a save is completed. A save encompasses destroying records, updating records and creating records.
+ * @param {Ext.data.Store} store
+ * @param {Number} batch The identifier for the batch that was saved.
+ * @param {Object} data An object containing the data that is to be saved. The object will contain a key for each appropriate action,
+ * with an array of records for each action.
+ */
+ 'save'
+
+ );
+
+ if(this.proxy){
+ // TODO remove deprecated loadexception with ext-3.0.1
+ this.relayEvents(this.proxy, ['loadexception', 'exception']);
+ }
+ // With a writer set for the Store, we want to listen to add/remove events to remotely create/destroy records.
+ if (this.writer) {
+ this.on({
+ scope: this,
+ add: this.createRecords,
+ remove: this.destroyRecord,
+ update: this.updateRecord,
+ clear: this.onClear
+ });
+ }
+
+ this.sortToggle = {};
+ if(this.sortField){
+ this.setDefaultSort(this.sortField, this.sortDir);
+ }else if(this.sortInfo){
+ this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);
+ }
+
+ Ext.data.Store.superclass.constructor.call(this);
+
+ if(this.id){
+ this.storeId = this.id;
+ delete this.id;
+ }
+ if(this.storeId){
+ Ext.StoreMgr.register(this);
+ }
+ if(this.inlineData){
+ this.loadData(this.inlineData);
+ delete this.inlineData;
+ }else if(this.autoLoad){
+ this.load.defer(10, this, [
+ typeof this.autoLoad == 'object' ?
+ this.autoLoad : undefined]);
+ }
+ // used internally to uniquely identify a batch
+ this.batchCounter = 0;
+ this.batches = {};
+ },
+
+ /**
+ * builds a DataWriter instance when Store constructor is provided with a writer config-object instead of an instace.
+ * @param {Object} config Writer configuration
+ * @return {Ext.data.DataWriter}
+ * @private
+ */
+ buildWriter : function(config) {
+ var klass = undefined,
+ type = (config.format || 'json').toLowerCase();
+ switch (type) {
+ case 'json':
+ klass = Ext.data.JsonWriter;
+ break;
+ case 'xml':
+ klass = Ext.data.XmlWriter;
+ break;
+ default:
+ klass = Ext.data.JsonWriter;
+ }
+ return new klass(config);
+ },
+