Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.data.writer.Json.html
diff --git a/docs/api/Ext.data.writer.Json.html b/docs/api/Ext.data.writer.Json.html
new file mode 100644 (file)
index 0000000..fc33a62
--- /dev/null
@@ -0,0 +1,125 @@
+<!DOCTYPE html><html><head><title>Ext.data.writer.Json | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
+<style type="text/css">.head-band { display: none; }
+.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
+.doc-tab .members .member a.more { background-color: #efefef; }
+</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
+</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
+<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
+
+    req = {
+        liveURL: '.',
+        standAloneMode: true,
+        origDocClass: 'Ext.data.writer.Json',
+        docClass: 'Ext.data.writer.Json',
+        docReq: 'Ext.data.writer.Json',
+        version: '4.0',
+        baseURL: '.',
+        baseDocURL: '.',
+        baseProdURL: '.'
+    };
+
+    clsInfo = {};
+
+
+
+</script>
+
+<script type="text/javascript" src="../search.js"></script>
+<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
+<script type="text/javascript" src="../class_tree.js"></script>
+<script type="text/javascript" src="../class_doc.js"></script>
+<script type="text/javascript">
+    req.source = 'Json2.html#Ext-data.writer.Json';
+    clsInfo = {"methods":["Json","getRecordData","write"],"cfgs":["allowSingle","encode","nameProperty","root","writeAllFields"],"properties":[],"events":[],"subclasses":[]};
+    Ext.onReady(function() {
+        Ext.create('Docs.classPanel');
+    });
+</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Json2.html#Ext-data.writer.Json" target="_blank">Ext.data.writer.Json</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><pre class="subclasses"><h4>Hierarchy</h4><div class="subclass f"><a href="Ext.data.writer.Writer.html" rel="Ext.data.writer.Writer" class="cls docClass">Ext.data.writer.Writer</a><div class="subclass"><strong>Ext.data.writer.Json</strong></div></div></pre>
+<div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-allowSingle" class="member f ni"><a href="Ext.data.writer.Json.html#config-allowSingle" rel="config-allowSingle" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Json.html" class="definedIn docClass">Ext.data.writer.Json</a><br/><a href="../source/Json2.html#Ext-data.writer.Json-cfg-allowSingle" class="viewSource">view source</a></div><a name="allowSingle"></a><a name="config-allowSingle"></a><a href="Ext.data.writer.Json.html#" rel="config-allowSingle" class="cls expand">allowSingle</a><span> : Boolean</span></div><div class="description"><div class="short">False to ensure that records are always wrapped in an array, even if there is only
+one record being sent. When there ...</div><div class="long"><p>False to ensure that records are always wrapped in an array, even if there is only
+one record being sent. When there is more than one record, they will always be encoded into an array.
+Defaults to <tt>true</tt>. Example:</p>
+
+<pre><code>// with allowSingle: true
+"root": {
+    "first": "Mark",
+    "last": "Corrigan"
+}
+
+// with allowSingle: false
+"root": [{
+    "first": "Mark",
+    "last": "Corrigan"
+}]
+</code></pre>
+
+</div></div></div><div id="config-encode" class="member ni"><a href="Ext.data.writer.Json.html#config-encode" rel="config-encode" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Json.html" class="definedIn docClass">Ext.data.writer.Json</a><br/><a href="../source/Json2.html#Ext-data.writer.Json-cfg-encode" class="viewSource">view source</a></div><a name="encode"></a><a name="config-encode"></a><a href="Ext.data.writer.Json.html#" rel="config-encode" class="cls expand">encode</a><span> : Boolean</span></div><div class="description"><div class="short">True to use Ext.encode() on the data before sending. Defaults to false.
+The encode option should only be set to true ...</div><div class="long"><p>True to use Ext.encode() on the data before sending. Defaults to <tt>false</tt>.
+The encode option should only be set to true when a <a href="Ext.data.writer.Json.html#root" rel="Ext.data.writer.Json#root" class="docClass">root</a> is defined, because the values will be
+sent as part of the request parameters as opposed to a raw post. The root will be the name of the parameter
+sent to the server.</p>
+</div></div></div><div id="config-nameProperty" class="member inherited"><a href="Ext.data.writer.Json.html#config-nameProperty" rel="config-nameProperty" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Writer.html" class="definedIn docClass">Ext.data.writer.Writer</a><br/><a href="../source/Writer.html#Ext-data.writer.Writer-cfg-nameProperty" class="viewSource">view source</a></div><a name="nameProperty"></a><a name="config-nameProperty"></a><a href="Ext.data.writer.Json.html#" rel="config-nameProperty" class="cls expand">nameProperty</a><span> : String</span></div><div class="description"><div class="short">This property is used to read the key for each value that will be sent to the server.
+For example:
+
+Ext.define('Perso...</div><div class="long"><p>This property is used to read the key for each value that will be sent to the server.
+For example:</p>
+
+<pre><code>Ext.define('Person', {
+    extend: 'Ext.data.Model',
+    fields: [{
+        name: 'first',
+        mapping: 'firstName'
+    }, {
+        name: 'last',
+        mapping: 'lastName'
+    }, {
+        name: 'age'
+    }]
+});
+new Ext.data.writer.Writer({
+    writeAllFields: true,
+    nameProperty: 'mapping'
+});
+
+// This will be sent to the server
+{
+    firstName: 'first name value',
+    lastName: 'last name value',
+    age: 1
+}
+
+</code></pre>
+
+
+<p>Defaults to <tt>name</tt>. If the value is not present, the field name will always be used.</p>
+</div></div></div><div id="config-root" class="member ni"><a href="Ext.data.writer.Json.html#config-root" rel="config-root" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Json.html" class="definedIn docClass">Ext.data.writer.Json</a><br/><a href="../source/Json2.html#Ext-data.writer.Json-cfg-root" class="viewSource">view source</a></div><a name="root"></a><a name="config-root"></a><a href="Ext.data.writer.Json.html#" rel="config-root" class="cls expand">root</a><span> : String</span></div><div class="description"><div class="short">The key under which the records in this Writer will be placed. Defaults to undefined.
+Example generated request, usin...</div><div class="long"><p>The key under which the records in this Writer will be placed. Defaults to <tt>undefined</tt>.
+Example generated request, using root: 'records':</p>
+
+<pre><code>{'records': [{name: 'my record'}, {name: 'another record'}]}
+</code></pre>
+
+</div></div></div><div id="config-writeAllFields" class="member inherited"><a href="Ext.data.writer.Json.html#config-writeAllFields" rel="config-writeAllFields" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Writer.html" class="definedIn docClass">Ext.data.writer.Writer</a><br/><a href="../source/Writer.html#Ext-data.writer.Writer-cfg-writeAllFields" class="viewSource">view source</a></div><a name="writeAllFields"></a><a name="config-writeAllFields"></a><a href="Ext.data.writer.Json.html#" rel="config-writeAllFields" class="cls expand">writeAllFields</a><span> : Boolean</span></div><div class="description"><div class="short">True to write all fields from the record to the server. If set to false it
+will only send the fields that were modifi...</div><div class="long"><p>True to write all fields from the record to the server. If set to false it
+will only send the fields that were modified. Defaults to <tt>true</tt>. Note that any fields that have
+<a href="Ext.data.Field.html#persist" rel="Ext.data.Field#persist" class="docClass">Ext.data.Field.persist</a> set to false will still be ignored.</p>
+</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Json" class="member f inherited"><a href="Ext.data.writer.Json.html#method-Json" rel="method-Json" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Writer.html" class="definedIn docClass">Ext.data.writer.Writer</a><br/><a href="../source/Writer.html#Ext-data.writer.Writer-method-constructor" class="viewSource">view source</a></div><a name="Json"></a><a name="method-Json"></a><a href="Ext.data.writer.Json.html#" rel="method-Json" class="cls expand">Json</a>(
+<span class="pre">Object config</span>)
+ : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
+<h3 class="pa">Parameters</h3><ul><li><span class="pre">config</span> : Object<div class="sub-desc"><p>Optional config object</p>
+</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
+</li></ul></div></div></div><div id="method-getRecordData" class="member inherited"><a href="Ext.data.writer.Json.html#method-getRecordData" rel="method-getRecordData" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Writer.html" class="definedIn docClass">Ext.data.writer.Writer</a><br/><a href="../source/Writer.html#Ext-data.writer.Writer-method-getRecordData" class="viewSource">view source</a></div><a name="getRecordData"></a><a name="method-getRecordData"></a><a href="Ext.data.writer.Json.html#" rel="method-getRecordData" class="cls expand">getRecordData</a>(
+<span class="pre">Object record</span>)
+ : Object</div><div class="description"><div class="short">Formats the data for each record before sending it to the server. This
+method should be overridden to format the data...</div><div class="long"><p>Formats the data for each record before sending it to the server. This
+method should be overridden to format the data in a way that differs from the default.</p>
+<h3 class="pa">Parameters</h3><ul><li><span class="pre">record</span> : Object<div class="sub-desc"><p>The record that we are writing to the server.</p>
+</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>An object literal of name/value keys to be written to the server.
+By default this method returns the data property on the record.</p>
+</li></ul></div></div></div><div id="method-write" class="member inherited"><a href="Ext.data.writer.Json.html#method-write" rel="method-write" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.writer.Writer.html" class="definedIn docClass">Ext.data.writer.Writer</a><br/><a href="../source/Writer.html#Ext-data.writer.Writer-method-write" class="viewSource">view source</a></div><a name="write"></a><a name="method-write"></a><a href="Ext.data.writer.Json.html#" rel="method-write" class="cls expand">write</a>(
+<span class="pre">Ext.data.Request request</span>)
+ : Ext.data.Request</div><div class="description"><div class="short"><p>Prepares a Proxy's <a href="Ext.data.Request.html" rel="Ext.data.Request" class="docClass">Ext.data.Request</a> object</p>
+</div><div class="long"><p>Prepares a Proxy's <a href="Ext.data.Request.html" rel="Ext.data.Request" class="docClass">Ext.data.Request</a> object</p>
+<h3 class="pa">Parameters</h3><ul><li><span class="pre">request</span> : Ext.data.Request<div class="sub-desc"><p>The request object</p>
+</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.Request</span>&nbsp; &nbsp;<p>The modified request object</p>
+</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>
\ No newline at end of file