3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
8 * @class Ext.data.ArrayStore
9 * @extends Ext.data.Store
10 * <p>Formerly known as "SimpleStore".</p>
11 * <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
12 * An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
13 * <p>A store configuration would be something like:<pre><code>
14 var store = new Ext.data.ArrayStore({
22 {name: 'price', type: 'float'},
23 {name: 'change', type: 'float'},
24 {name: 'pctChange', type: 'float'},
25 {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
29 * <p>This store is configured to consume a returned object of the form:<pre><code>
31 ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
32 ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
33 ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
34 ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
35 ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
38 * An object literal of this form could also be used as the {@link #data} config option.</p>
39 * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
40 * <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
42 * @param {Object} config
45 Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
47 * @cfg {Ext.data.DataReader} reader @hide
49 constructor: function(config){
50 Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
51 reader: new Ext.data.ArrayReader(config)
55 loadData : function(data, append){
56 if(this.expandData === true){
58 for(var i = 0, len = data.length; i < len; i++){
59 r[r.length] = [data[i]];
63 Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
66 Ext.reg('arraystore', Ext.data.ArrayStore);
69 Ext.data.SimpleStore = Ext.data.ArrayStore;
70 Ext.reg('simplestore', Ext.data.SimpleStore);