Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / source / Api.html
index 3c9fbb6..5521c9c 100644 (file)
@@ -1,17 +1,12 @@
-<html>
-<head>
-  <title>The source code</title>
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-
+<html>\r
+<head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">
 <div id="cls-Ext.data.Api"></div>/**
  * @class Ext.data.Api
  * @extends Object
 <div id="cls-Ext.data.Api"></div>/**
  * @class Ext.data.Api
  * @extends Object
@@ -176,7 +171,8 @@ new Ext.data.HttpProxy({
                 proxy.api[action] = proxy.api[action] || proxy.url || proxy.directFn;
                 if (typeof(proxy.api[action]) == 'string') {
                     proxy.api[action] = {
                 proxy.api[action] = proxy.api[action] || proxy.url || proxy.directFn;
                 if (typeof(proxy.api[action]) == 'string') {
                     proxy.api[action] = {
-                        url: proxy.api[action]
+                        url: proxy.api[action],
+                        method: (proxy.restful === true) ? Ext.data.Api.restActions[action] : undefined
                     };
                 }
             }
                     };
                 }
             }
@@ -190,7 +186,8 @@ new Ext.data.HttpProxy({
         restify : function(proxy) {
             proxy.restful = true;
             for (var verb in this.restActions) {
         restify : function(proxy) {
             proxy.restful = true;
             for (var verb in this.restActions) {
-                proxy.api[this.actions[verb]].method = this.restActions[verb];
+                proxy.api[this.actions[verb]].method ||
+                    (proxy.api[this.actions[verb]].method = this.restActions[verb]);
             }
             // TODO: perhaps move this interceptor elsewhere?  like into DataProxy, perhaps?  Placed here
             // to satisfy initial 3.0 final release of REST features.
             }
             // TODO: perhaps move this interceptor elsewhere?  like into DataProxy, perhaps?  Placed here
             // to satisfy initial 3.0 final release of REST features.
@@ -202,16 +199,18 @@ new Ext.data.HttpProxy({
                 });
 
                 switch (response.status) {
                 });
 
                 switch (response.status) {
-                    case 200:   // standard 200 response, send control back to HttpProxy#onWrite
+                    case 200:   // standard 200 response, send control back to HttpProxy#onWrite by returning true from this intercepted #onWrite
                         return true;
                         break;
                     case 201:   // entity created but no response returned
                         return true;
                         break;
                     case 201:   // entity created but no response returned
-                        //res[reader.meta.successProperty] = true;
-                        res.success = true;
+                        if (Ext.isEmpty(res.raw.responseText)) {
+                          res.success = true;
+                        } else {
+                          //if the response contains data, treat it like a 200
+                          return true;
+                        }
                         break;
                     case 204:  // no-content.  Create a fake response.
                         break;
                     case 204:  // no-content.  Create a fake response.
-                        //res[reader.meta.successProperty] = true;
-                        //res[reader.meta.root] = null;
                         res.success = true;
                         res.data = null;
                         break;
                         res.success = true;
                         res.data = null;
                         break;
@@ -219,13 +218,6 @@ new Ext.data.HttpProxy({
                         return true;
                         break;
                 }
                         return true;
                         break;
                 }
-                /*
-                if (res[reader.meta.successProperty] === true) {
-                    this.fireEvent("write", this, action, res[reader.meta.root], res, rs, o.request.arg);
-                } else {
-                    this.fireEvent('exception', this, 'remote', action, o, res, rs);
-                }
-                */
                 if (res.success === true) {
                     this.fireEvent("write", this, action, res.data, res, rs, o.request.arg);
                 } else {
                 if (res.success === true) {
                     this.fireEvent("write", this, action, res.data, res, rs, o.request.arg);
                 } else {
@@ -262,7 +254,7 @@ Ext.data.Response.prototype = {
         return this.success;
     },
     getStatus : function() {
         return this.success;
     },
     getStatus : function() {
-        return this.status
+        return this.status;
     },
     getRoot : function() {
         return this.root;
     },
     getRoot : function() {
         return this.root;
@@ -294,6 +286,6 @@ Ext.apply(Ext.data.Api.Error.prototype, {
 });
 
 
 });
 
 
-</pre>
-</body>
+</pre>    \r
+</body>\r
 </html>
\ No newline at end of file
 </html>
\ No newline at end of file