X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..6b044c28b5f26fb99c86c237ffad19741c0f7f3d:/pkgs/data-xml-debug.js?ds=inline
diff --git a/pkgs/data-xml-debug.js b/pkgs/data-xml-debug.js
index 56653a5f..3967424f 100644
--- a/pkgs/data-xml-debug.js
+++ b/pkgs/data-xml-debug.js
@@ -1,21 +1,38 @@
/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
/**
* @class Ext.data.XmlWriter
* @extends Ext.data.DataWriter
* DataWriter extension for writing an array or single {@link Ext.data.Record} object(s) in preparation for executing a remote CRUD action via XML.
+ * XmlWriter uses an instance of {@link Ext.XTemplate} for maximum flexibility in defining your own custom XML schema if the default schema is not appropriate for your needs.
+ * See the {@link #tpl} configuration-property.
*/
Ext.data.XmlWriter = function(params) {
Ext.data.XmlWriter.superclass.constructor.apply(this, arguments);
- this.tpl = new Ext.XTemplate(this.tpl).compile();
+ // compile the XTemplate for rendering XML documents.
+ this.tpl = (typeof(this.tpl) === 'string') ? new Ext.XTemplate(this.tpl).compile() : this.tpl.compile();
};
Ext.extend(Ext.data.XmlWriter, Ext.data.DataWriter, {
/**
- * @cfg {String} root [records] The name of the root element when writing multiple records to the server. Each
+ * @cfg {String} documentRoot [xrequest] (Optional) The name of the XML document root-node. Note:
+ * this parameter is required only when sending extra {@link Ext.data.Store#baseParams baseParams} to the server
+ * during a write-request -- if no baseParams are set, the {@link Ext.data.XmlReader#record} meta-property can
+ * suffice as the XML document root-node for write-actions involving just a single record. For requests
+ * involving multiple records and NO baseParams, the {@link Ext.data.XmlWriter#root} property can
+ * act as the XML document root.
+ */
+ documentRoot: 'xrequest',
+ /**
+ * @cfg {Boolean} forceDocumentRoot [false] Set to true to force XML documents having a root-node as defined
+ * by {@link #documentRoot}, even with no baseParams defined.
+ */
+ forceDocumentRoot: false,
+ /**
+ * @cfg {String} root [records] The name of the containing element which will contain the nodes of an write-action involving multiple records. Each
* xml-record written to the server will be wrapped in an element named after {@link Ext.data.XmlReader#record} property.
* eg:
- * Defaults to records
+ * Defaults to records. Do not confuse the nature of this property with that of {@link #documentRoot}
*/
root: 'records',
/**
@@ -46,91 +63,99 @@ Ext.extend(Ext.data.XmlWriter, Ext.data.DataWriter, {
*/
xmlEncoding: 'ISO-8859-15',
/**
- * @cfg {String} tpl The xml template. Defaults to
+ * @cfg {String/Ext.XTemplate} tpl The XML template used to render {@link Ext.data.Api#actions write-actions} to your server.
+ *
@@ -32,7 +49,7 @@ Ext.extend(Ext.data.XmlWriter, Ext.data.DataWriter, {
<records><first>Barney</first></user>
</records>
One can easily provide his/her own custom {@link Ext.XTemplate#constructor template-definition} if the default does not suffice.
+ *Defaults to:
<?xml version="{version}" encoding="{encoding}"?>
- <tpl if="{[values.nodes.length>1]}"><{root}}>',
+ <tpl if="documentRoot"><{documentRoot}>
+ <tpl for="baseParams">
+ <tpl for=".">
+ <{name}>{value}</{name}>
+ </tpl>
+ </tpl>
+ <tpl if="records.length > 1"><{root}>',
<tpl for="records">
<{parent.record}>
- <tpl for="fields">
+ <tpl for=".">
<{name}>{value}</{name}>
</tpl>
</{parent.record}>
</tpl>
- <tpl if="{[values.records.length>1]}"></{root}}></tpl>
+ <tpl if="records.length > 1"></{root}></tpl>
+ <tpl if="documentRoot"></{documentRoot}></tpl>
+ * Templates will be called with the following API
+ *Small helper class to make creating {@link Ext.data.Store}s from XML data easier. - * A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.
- *A store configuration would be something like:
-var store = new Ext.data.XmlStore({
- // store configs
- autoDestroy: true,
- storeId: 'myStore',
- url: 'sheldon.xml', // automatically configures a HttpProxy
- // reader configs
- record: 'Item', // records will have an "Item" tag
- idPath: 'ASIN',
- totalRecords: '@TotalResults'
- fields: [
- // set up the fields mapping into the xml doc
- // The first needs mapping, the others are very basic
- {name: 'Author', mapping: 'ItemAttributes > Author'},
- 'Title', 'Manufacturer', 'ProductGroup'
- ]
-});
- *
- * This store is configured to consume a returned object of the form:
-<?xml version="1.0" encoding="UTF-8"?>
-<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">
- <Items>
- <Request>
- <IsValid>True</IsValid>
- <ItemSearchRequest>
- <Author>Sidney Sheldon</Author>
- <SearchIndex>Books</SearchIndex>
- </ItemSearchRequest>
- </Request>
- <TotalResults>203</TotalResults>
- <TotalPages>21</TotalPages>
- <Item>
- <ASIN>0446355453</ASIN>
- <DetailPageURL>
- http://www.amazon.com/
- </DetailPageURL>
- <ItemAttributes>
- <Author>Sidney Sheldon</Author>
- <Manufacturer>Warner Books</Manufacturer>
- <ProductGroup>Book</ProductGroup>
- <Title>Master of the Game</Title>
- </ItemAttributes>
- </Item>
- </Items>
-</ItemSearchResponse>
- *
- * An object literal of this form could also be used as the {@link #data} config option.
- * Note: Although not listed here, this class accepts all of the configuration options of - * {@link Ext.data.XmlReader XmlReader}.
- * @constructor - * @param {Object} config - * @xtype xmlstore - */ -Ext.data.XmlStore = Ext.extend(Ext.data.Store, { - /** - * @cfg {Ext.data.DataReader} reader @hide - */ - constructor: function(config){ - Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, { - reader: new Ext.data.XmlReader(config) - })); - } -}); +});/** + * @class Ext.data.XmlStore + * @extends Ext.data.Store + *Small helper class to make creating {@link Ext.data.Store}s from XML data easier. + * A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.
+ *A store configuration would be something like:
+var store = new Ext.data.XmlStore({
+ // store configs
+ autoDestroy: true,
+ storeId: 'myStore',
+ url: 'sheldon.xml', // automatically configures a HttpProxy
+ // reader configs
+ record: 'Item', // records will have an "Item" tag
+ idPath: 'ASIN',
+ totalRecords: '@TotalResults'
+ fields: [
+ // set up the fields mapping into the xml doc
+ // The first needs mapping, the others are very basic
+ {name: 'Author', mapping: 'ItemAttributes > Author'},
+ 'Title', 'Manufacturer', 'ProductGroup'
+ ]
+});
+ *
+ * This store is configured to consume a returned object of the form:
+<?xml version="1.0" encoding="UTF-8"?>
+<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">
+ <Items>
+ <Request>
+ <IsValid>True</IsValid>
+ <ItemSearchRequest>
+ <Author>Sidney Sheldon</Author>
+ <SearchIndex>Books</SearchIndex>
+ </ItemSearchRequest>
+ </Request>
+ <TotalResults>203</TotalResults>
+ <TotalPages>21</TotalPages>
+ <Item>
+ <ASIN>0446355453</ASIN>
+ <DetailPageURL>
+ http://www.amazon.com/
+ </DetailPageURL>
+ <ItemAttributes>
+ <Author>Sidney Sheldon</Author>
+ <Manufacturer>Warner Books</Manufacturer>
+ <ProductGroup>Book</ProductGroup>
+ <Title>Master of the Game</Title>
+ </ItemAttributes>
+ </Item>
+ </Items>
+</ItemSearchResponse>
+ *
+ * An object literal of this form could also be used as the {@link #data} config option.
+ * Note: Although not listed here, this class accepts all of the configuration options of + * {@link Ext.data.XmlReader XmlReader}.
+ * @constructor + * @param {Object} config + * @xtype xmlstore + */ +Ext.data.XmlStore = Ext.extend(Ext.data.Store, { + /** + * @cfg {Ext.data.DataReader} reader @hide + */ + constructor: function(config){ + Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, { + reader: new Ext.data.XmlReader(config) + })); + } +}); Ext.reg('xmlstore', Ext.data.XmlStore); \ No newline at end of file