3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.data.MemoryProxy"></div>/**
\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 // Must define a dummy api with "read" action to satisfy DataProxy#doRequest and Ext.data.Api#prepare *before* calling super
\r
20 api[Ext.data.Api.actions.read] = true;
\r
21 Ext.data.MemoryProxy.superclass.constructor.call(this, {
\r
27 Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
\r
28 <div id="event-Ext.data.MemoryProxy-loadexception"></div>/**
\r
29 * @event loadexception
\r
30 * Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
\r
31 * through {@link Ext.data.Store}, so you can listen for it directly on any Store instance.
\r
32 * @param {Object} this
\r
33 * @param {Object} arg The callback's arg object passed to the {@link #load} function
\r
34 * @param {Object} null This parameter does not apply and will always be null for MemoryProxy
\r
35 * @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data
\r
38 <div id="method-Ext.data.MemoryProxy-doRequest"></div>/**
\r
39 * MemoryProxy implementation of DataProxy#doRequest
\r
40 * @param {String} action
\r
41 * @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null
\r
42 * @param {Object} params An object containing properties which are to be used as HTTP parameters
\r
43 * for the request to the remote server.
\r
44 * @param {Ext.data.DataReader} reader The Reader object which converts the data
\r
45 * object into a block of Ext.data.Records.
\r
46 * @param {Function} callback The function into which to pass the block of Ext.data.Records.
\r
47 * The function must be passed <ul>
\r
48 * <li>The Record block object</li>
\r
49 * <li>The "arg" argument from the load function</li>
\r
50 * <li>A boolean success indicator</li>
\r
52 * @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
\r
53 * @param {Object} arg An optional argument which is passed to the callback as its second parameter.
\r
55 doRequest : function(action, rs, params, reader, callback, scope, arg) {
\r
56 // No implementation for CRUD in MemoryProxy. Assumes all actions are 'load'
\r
57 params = params || {};
\r
60 result = reader.readRecords(this.data);
\r
62 // @deprecated loadexception
\r
63 this.fireEvent("loadexception", this, null, arg, e);
\r
65 this.fireEvent('exception', this, 'response', action, arg, null, e);
\r
66 callback.call(scope, null, arg, false);
\r
69 callback.call(scope, result, arg, true);
\r