49 lines
No EOL
2.5 KiB
HTML
49 lines
No EOL
2.5 KiB
HTML
<html><head><title>MemoryProxy.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>MemoryProxy.js</h1><pre class="highlighted"><code><i>/**
|
|
* @class Ext.data.MemoryProxy
|
|
* An implementation of Ext.data.DataProxy that simply passes the data specified <b>in</b> its constructor
|
|
* to the Reader when its load method is called.
|
|
* @constructor
|
|
* @param {Object} data The data object which the Reader uses to construct a block of Ext.data.Records.
|
|
*/</i>
|
|
Ext.data.MemoryProxy = <b>function</b>(data){
|
|
Ext.data.MemoryProxy.superclass.constructor.call(<b>this</b>);
|
|
<b>this</b>.data = data;
|
|
};
|
|
|
|
Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
|
|
<i>/**
|
|
* Load data from the requested source (<b>in</b> this <b>case</b> an <b>in</b>-memory
|
|
* data object passed to the constructor), read the data object into
|
|
* a block of Ext.data.Records using the passed Ext.data.DataReader implementation, and
|
|
* process that block using the passed callback.
|
|
* @param {Object} params This parameter is not used by the MemoryProxy class.
|
|
* @param {Ext.data.DataReader) reader The Reader object which converts the data
|
|
* object into a block of Ext.data.Records.
|
|
* @param {Function} callback The <b>function</b> into which to pass the block of Ext.data.records.
|
|
* The <b>function</b> must be passed <ul>
|
|
* <li>The Record block object</li>
|
|
* <li>The "arg" argument from the load <b>function</b></li>
|
|
* <li>A boolean success indicator</li>
|
|
* </ul>
|
|
* @param {Object} scope The scope <b>in</b> which to call the callback
|
|
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
|
|
*/</i>
|
|
load : <b>function</b>(params, reader, callback, scope, arg){
|
|
params = params || {};
|
|
<b>var</b> result;
|
|
try {
|
|
result = reader.readRecords(<b>this</b>.data);
|
|
}catch(e){
|
|
<b>this</b>.fireEvent("loadexception", <b>this</b>, arg, null, e);
|
|
callback.call(scope, null, arg, false);
|
|
<b>return</b>;
|
|
}
|
|
callback.call(scope, result, arg, true);
|
|
},
|
|
|
|
<i>// private</i>
|
|
update : <b>function</b>(params, records){
|
|
|
|
}
|
|
});</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright © 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
|
|
</body></html> |