]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * @class Ext.data.JsonPStore\r | |
3 | * @extends Ext.data.Store\r | |
4 | * <p>Small helper class to make creating {@link Ext.data.Store}s from different domain JSON data easier.\r | |
5 | * A JsonPStore will be automatically configured with a {@link Ext.data.reader.Json} and a {@link Ext.data.proxy.JsonP JsonPProxy}.</p>\r | |
6 | * <p>A store configuration would be something like:<pre><code>\r | |
7 | var store = new Ext.data.JsonPStore({\r | |
8 | // store configs\r | |
9 | storeId: 'myStore',\r | |
10 | \r | |
11 | // proxy configs\r | |
12 | url: 'get-images.php',\r | |
13 | \r | |
14 | // reader configs\r | |
15 | root: 'images',\r | |
16 | fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]\r | |
17 | });\r | |
18 | * </code></pre></p>\r | |
19 | * <p>This store is configured to consume a returned object of the form:<pre><code>\r | |
20 | stcCallback({\r | |
21 | images: [\r | |
22 | {name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},\r | |
23 | {name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}\r | |
24 | ]\r | |
25 | })\r | |
26 | * </code></pre>\r | |
27 | * <p>Where stcCallback is the callback name passed in the request to the remote domain. See {@link Ext.data.proxy.JsonP JsonPProxy}\r | |
28 | * for details of how this works.</p>\r | |
29 | * An object literal of this form could also be used as the {@link #cfg-data} config option.</p>\r | |
30 | * @xtype jsonpstore\r | |
31 | */\r | |
32 | Ext.define('Ext.data.JsonPStore', {\r | |
33 | extend: 'Ext.data.Store',\r | |
34 | alias : 'store.jsonp',\r | |
35 | requires: [\r | |
36 | 'Ext.data.proxy.JsonP',\r | |
37 | 'Ext.data.reader.Json'\r | |
38 | ],\r | |
39 | \r | |
40 | constructor: function(config) {\r | |
41 | config = Ext.apply({\r | |
42 | proxy: {\r | |
43 | type: 'jsonp',\r | |
44 | reader: 'json'\r | |
45 | }\r | |
46 | }, config);\r | |
47 | this.callParent([config]);\r | |
48 | }\r | |
49 | }); |