3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.data.ArrayStore"></div>/**
9 * @class Ext.data.ArrayStore
10 * @extends Ext.data.Store
11 * <p>Formerly known as "SimpleStore".</p>
12 * <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
13 * An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
14 * <p>A store configuration would be something like:<pre><code>
15 var store = new Ext.data.ArrayStore({
23 {name: 'price', type: 'float'},
24 {name: 'change', type: 'float'},
25 {name: 'pctChange', type: 'float'},
26 {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
30 * <p>This store is configured to consume a returned object of the form:<pre><code>
32 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
33 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
34 ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
35 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
36 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
39 * An object literal of this form could also be used as the {@link #data} config option.</p>
40 * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
41 * <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
43 * @param {Object} config
46 Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
47 <div id="cfg-Ext.data.ArrayStore-reader"></div>/**
48 * @cfg {Ext.data.DataReader} reader @hide
50 constructor: function(config){
51 Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
52 reader: new Ext.data.ArrayReader(config)
56 loadData : function(data, append){
57 if(this.expandData === true){
59 for(var i = 0, len = data.length; i < len; i++){
60 r[r.length] = [data[i]];
64 Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
67 Ext.reg('arraystore', Ext.data.ArrayStore);
70 Ext.data.SimpleStore = Ext.data.ArrayStore;
71 Ext.reg('simplestore', Ext.data.SimpleStore);</pre>
\r