initial import
[roojs1] / Roo / data / JsonStore.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 /**
14  * @extends Roo.data.Store
15  * @class Roo.data.JsonStore
16  * Small helper class to make creating Stores for JSON data easier. <br/>
17 <pre><code>
18 var store = new Roo.data.JsonStore({
19     url: 'get-images.php',
20     root: 'images',
21     fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
22 });
23 </code></pre>
24  * <b>Note: Although they are not listed, this class inherits all of the config options of Store,
25  * JsonReader and HttpProxy (unless inline data is provided).</b>
26  * @cfg {Array} fields An array of field definition objects, or field name strings.
27  * @constructor
28  * @param {Object} config
29  */
30 Roo.data.JsonStore = function(c){
31     Roo.data.JsonStore.superclass.constructor.call(this, Roo.apply(c, {
32         proxy: !c.data ? new Roo.data.HttpProxy({url: c.url}) : undefined,
33         reader: new Roo.data.JsonReader(c, c.fields)
34     }));
35 };
36 Roo.extend(Roo.data.JsonStore, Roo.data.Store);