2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
10 * @class Ext.data.MemoryProxy
\r
11 * @extends Ext.data.DataProxy
\r
12 * An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor
\r
13 * to the Reader when its load method is called.
\r
15 * @param {Object} data The data object which the Reader uses to construct a block of Ext.data.Records.
\r
17 Ext.data.MemoryProxy = function(data){
\r
18 Ext.data.MemoryProxy.superclass.constructor.call(this);
\r
22 Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
\r
24 * @event loadexception
\r
25 * Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
\r
26 * through {@link Ext.data.Store}, so you can listen for it directly on any Store instance.
\r
27 * @param {Object} this
\r
28 * @param {Object} arg The callback's arg object passed to the {@link #load} function
\r
29 * @param {Object} null This parameter does not apply and will always be null for MemoryProxy
\r
30 * @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data
\r
34 * Load data from the requested source (in this case an in-memory
\r
35 * data object passed to the constructor), read the data object into
\r
36 * a block of Ext.data.Records using the passed Ext.data.DataReader implementation, and
\r
37 * process that block using the passed callback.
\r
38 * @param {Object} params This parameter is not used by the MemoryProxy class.
\r
39 * @param {Ext.data.DataReader} reader The Reader object which converts the data
\r
40 * object into a block of Ext.data.Records.
\r
41 * @param {Function} callback The function into which to pass the block of Ext.data.records.
\r
42 * The function must be passed <ul>
\r
43 * <li>The Record block object</li>
\r
44 * <li>The "arg" argument from the load function</li>
\r
45 * <li>A boolean success indicator</li>
\r
47 * @param {Object} scope The scope in which to call the callback
\r
48 * @param {Object} arg An optional argument which is passed to the callback as its second parameter.
\r
50 load : function(params, reader, callback, scope, arg){
\r
51 params = params || {};
\r
54 result = reader.readRecords(this.data);
\r
56 this.fireEvent("loadexception", this, arg, null, e);
\r
57 callback.call(scope, null, arg, false);
\r
60 callback.call(scope, result, arg, true);
\r
64 update : function(params, records){
\r