]> git.proxmox.com Git - extjs.git/blame - extjs/packages/core/src/data/XmlStore.js
add extjs 6.0.1 sources
[extjs.git] / extjs / packages / core / src / data / XmlStore.js
CommitLineData
6527f429
DM
1/**\r
2 * <p>Small helper class to make creating {@link Ext.data.Store}s from XML data easier.\r
3 * A XmlStore will be automatically configured with a {@link Ext.data.reader.Xml}.</p>\r
4 * <p>A store configuration would be something like:<pre><code>\r
5var store = new Ext.data.XmlStore({\r
6 // store configs\r
7 storeId: 'myStore',\r
8 url: 'sheldon.xml', // automatically configures a HttpProxy\r
9 // reader configs\r
10 record: 'Item', // records will have an "Item" tag\r
11 idPath: 'ASIN',\r
12 totalRecords: '@TotalResults'\r
13 fields: [\r
14 // set up the fields mapping into the xml doc\r
15 // The first needs mapping, the others are very basic\r
16 {name: 'Author', mapping: 'ItemAttributes > Author'},\r
17 'Title', 'Manufacturer', 'ProductGroup'\r
18 ]\r
19});\r
20 * </code></pre></p>\r
21 * <p>This store is configured to consume a returned object of the form:<pre><code>\r
22&#60?xml version="1.0" encoding="UTF-8"?>\r
23&#60ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">\r
24 &#60Items>\r
25 &#60Request>\r
26 &#60IsValid>True&#60/IsValid>\r
27 &#60ItemSearchRequest>\r
28 &#60Author>Sidney Sheldon&#60/Author>\r
29 &#60SearchIndex>Books&#60/SearchIndex>\r
30 &#60/ItemSearchRequest>\r
31 &#60/Request>\r
32 &#60TotalResults>203&#60/TotalResults>\r
33 &#60TotalPages>21&#60/TotalPages>\r
34 &#60Item>\r
35 &#60ASIN>0446355453&#60/ASIN>\r
36 &#60DetailPageURL>\r
37 http://www.amazon.com/\r
38 &#60/DetailPageURL>\r
39 &#60ItemAttributes>\r
40 &#60Author>Sidney Sheldon&#60/Author>\r
41 &#60Manufacturer>Warner Books&#60/Manufacturer>\r
42 &#60ProductGroup>Book&#60/ProductGroup>\r
43 &#60Title>Master of the Game&#60/Title>\r
44 &#60/ItemAttributes>\r
45 &#60/Item>\r
46 &#60/Items>\r
47&#60/ItemSearchResponse>\r
48 * </code></pre>\r
49 * An object literal of this form could also be used as the {@link #cfg-data} config option.</p>\r
50 * <p><b>Note:</b> This class accepts all of the configuration options of\r
51 * <b>{@link Ext.data.reader.Xml XmlReader}</b>.</p>\r
52 */\r
53Ext.define('Ext.data.XmlStore', {\r
54 extend: 'Ext.data.Store',\r
55 alias: 'store.xml',\r
56\r
57 requires: [\r
58 'Ext.data.proxy.Ajax',\r
59 'Ext.data.reader.Xml',\r
60 'Ext.data.writer.Xml'\r
61 ],\r
62 \r
63 constructor: function(config){\r
64 config = Ext.apply({\r
65 proxy: {\r
66 type: 'ajax',\r
67 reader: 'xml',\r
68 writer: 'xml'\r
69 }\r
70 }, config);\r
71\r
72 this.callParent([config]);\r
73 }\r
74});