3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.data.ArrayStore"></div>/**
16 * @class Ext.data.ArrayStore
17 * @extends Ext.data.Store
18 * <p>Formerly known as "SimpleStore".</p>
19 * <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
20 * An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
21 * <p>A store configuration would be something like:<pre><code>
22 var store = new Ext.data.ArrayStore({
30 {name: 'price', type: 'float'},
31 {name: 'change', type: 'float'},
32 {name: 'pctChange', type: 'float'},
33 {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
37 * <p>This store is configured to consume a returned object of the form:<pre><code>
39 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
40 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
41 ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
42 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
43 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
46 * An object literal of this form could also be used as the {@link #data} config option.</p>
47 * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
48 * <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
50 * @param {Object} config
53 Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
54 <div id="cfg-Ext.data.ArrayStore-reader"></div>/**
55 * @cfg {Ext.data.DataReader} reader @hide
57 constructor: function(config){
58 Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
59 reader: new Ext.data.ArrayReader(config)
63 loadData : function(data, append){
64 if(this.expandData === true){
66 for(var i = 0, len = data.length; i < len; i++){
67 r[r.length] = [data[i]];
71 Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
74 Ext.reg('arraystore', Ext.data.ArrayStore);
77 Ext.data.SimpleStore = Ext.data.ArrayStore;
78 Ext.reg('simplestore', Ext.data.SimpleStore);</pre>