4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
12 * @class Roo.data.MemoryProxy
13 * @extends Roo.data.DataProxy
14 * An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
15 * to the Reader when its load method is called.
17 * @param {Object} config A config object containing the objects needed for the Store to access data,
19 Roo.data.MemoryProxy = function(config){
21 if (typeof(config) != 'undefined' && typeof(config.data) != 'undefined') {
24 Roo.data.MemoryProxy.superclass.constructor.call(this);
28 Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, {
31 * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
34 * Load data from the requested source (in this case an in-memory
35 * data object passed to the constructor), read the data object into
36 * a block of Roo.data.Records using the passed Roo.data.DataReader implementation, and
37 * process that block using the passed callback.
38 * @param {Object} params This parameter is not used by the MemoryProxy class.
39 * @param {Roo.data.DataReader} reader The Reader object which converts the data
40 * object into a block of Roo.data.Records.
41 * @param {Function} callback The function into which to pass the block of Roo.data.records.
42 * The function must be passed <ul>
43 * <li>The Record block object</li>
44 * <li>The "arg" argument from the load function</li>
45 * <li>A boolean success indicator</li>
47 * @param {Object} scope The scope in which to call the callback
48 * @param {Object} arg An optional argument which is passed to the callback as its second parameter.
50 load : function(params, reader, callback, scope, arg){
51 params = params || {};
54 result = reader.readRecords(params.data ? params.data :this.data);
56 this.fireEvent("loadexception", this, arg, null, e);
57 callback.call(scope, null, arg, false);
60 callback.call(scope, result, arg, true);
64 update : function(params, records){