Merge branch 'master' of http://git.roojs.com/roojs1
[roojs1] / Roo / data / SimpleStore.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11
12 /**
13  * @class Roo.data.SimpleStore
14  * @extends Roo.data.Store
15  * Small helper class to make creating Stores from Array data easier.
16  * @cfg {Number} id The array index of the record id. Leave blank to auto generate ids.
17  * @cfg {Array} fields An array of field definition objects, or field name strings.
18  * @cfg {Object} an existing reader (eg. copied from another store)
19  * @cfg {Array} data The multi-dimensional array of data
20  * @cfg {Roo.data.DataProxy} proxy [not-required]  
21  * @cfg {Roo.data.Reader} reader  [not-required] 
22  * @constructor
23  * @param {Object} config
24  */
25 Roo.data.SimpleStore = function(config)
26 {
27     Roo.data.SimpleStore.superclass.constructor.call(this, {
28         isLocal : true,
29         reader: typeof(config.reader) != 'undefined' ? config.reader : new Roo.data.ArrayReader({
30                 id: config.id
31             },
32             Roo.data.Record.create(config.fields)
33         ),
34         proxy : new Roo.data.MemoryProxy(config.data)
35     });
36     this.load();
37 };
38 Roo.extend(Roo.data.SimpleStore, Roo.data.Store);