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.ArrayStore"></div>/**
10 * @class Ext.data.ArrayStore
11 * @extends Ext.data.Store
12 * <p>Formerly known as "SimpleStore".</p>
13 * <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
14 * An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
15 * <p>A store configuration would be something like:<pre><code>
16 var store = new Ext.data.ArrayStore({
24 {name: 'price', type: 'float'},
25 {name: 'change', type: 'float'},
26 {name: 'pctChange', type: 'float'},
27 {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
31 * <p>This store is configured to consume a returned object of the form:<pre><code>
33 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
34 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
35 ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
36 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
37 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
40 * An object literal of this form could also be used as the {@link #data} config option.</p>
41 * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
42 * <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
44 * @param {Object} config
47 Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
48 <div id="cfg-Ext.data.ArrayStore-reader"></div>/**
49 * @cfg {Ext.data.DataReader} reader @hide
51 constructor: function(config){
52 Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
53 reader: new Ext.data.ArrayReader(config)
57 loadData : function(data, append){
58 if(this.expandData === true){
60 for(var i = 0, len = data.length; i < len; i++){
61 r[r.length] = [data[i]];
65 Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
68 Ext.reg('arraystore', Ext.data.ArrayStore);
71 Ext.data.SimpleStore = Ext.data.ArrayStore;
72 Ext.reg('simplestore', Ext.data.SimpleStore);</pre>
\r