Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / pkgs / data-foundation-debug.js
index 8d19389..72b6353 100644 (file)
@@ -1,6 +1,6 @@
 /*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
@@ -184,7 +184,8 @@ new Ext.data.HttpProxy({
         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.
@@ -200,7 +201,12 @@ new Ext.data.HttpProxy({
                         return true;
                         break;
                     case 201:   // entity created but no response returned
-                        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.
                         res.success = true;
@@ -246,7 +252,7 @@ Ext.data.Response.prototype = {
         return this.success;
     },
     getStatus : function() {
-        return this.status
+        return this.status;
     },
     getRoot : function() {
         return this.root;
@@ -1098,13 +1104,7 @@ sortInfo: {
         this.data.getKey = function(o){
             return o.id;
         };
-        /**
-         * See the <code>{@link #baseParams corresponding configuration option}</code>
-         * for a description of this property.
-         * To modify this property see <code>{@link #setBaseParam}</code>.
-         * @property
-         */
-        this.baseParams = {};
+
 
         // temporary removed-records cache
         this.removed = [];
@@ -1116,6 +1116,14 @@ sortInfo: {
 
         Ext.apply(this, config);
 
+        /**
+         * See the <code>{@link #baseParams corresponding configuration option}</code>
+         * for a description of this property.
+         * To modify this property see <code>{@link #setBaseParam}</code>.
+         * @property
+         */
+        this.baseParams = Ext.isObject(this.baseParams) ? this.baseParams : {};
+
         this.paramNames = Ext.applyIf(this.paramNames || {}, this.defaultParamNames);
 
         if((this.url || this.api) && !this.proxy){
@@ -1401,8 +1409,8 @@ sortInfo: {
      * @private
      */
     buildWriter : function(config) {
-        var klass = undefined;
-        type = (config.format || 'json').toLowerCase();
+        var klass = undefined,
+            type = (config.format || 'json').toLowerCase();
         switch (type) {
             case 'json':
                 klass = Ext.data.JsonWriter;
@@ -1741,8 +1749,8 @@ sortInfo: {
         var doRequest = true;
 
         if (action === 'read') {
-            Ext.applyIf(options.params, this.baseParams);
             doRequest = this.fireEvent('beforeload', this, options);
+            Ext.applyIf(options.params, this.baseParams);
         }
         else {
             // if Writer is configured as listful, force single-record rs to be [{}] instead of {}
@@ -3805,6 +3813,17 @@ if ($callback) {
     header('Content-Type: application/x-json');\r
     echo json_encode($output);\r
 }\r
+</code></pre>\r
+ * <p>Below is the ASP.Net code to do the same thing:</p><pre><code>\r
+String jsonString = "{success: true}";\r
+String cb = Request.Params.Get("callback");\r
+String responseString = "";\r
+if (!String.IsNullOrEmpty(cb)) {\r
+    responseString = cb + "(" + jsonString + ")";\r
+} else {\r
+    responseString = jsonString;\r
+}\r
+Response.Write(responseString);\r
 </code></pre>\r
  *\r
  * @constructor\r
@@ -4210,7 +4229,7 @@ Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
             } else {\r
                 this.onWrite(action, o, response, rs);\r
             }\r
-        }\r
+        };\r
     },\r
 \r
     /**\r
@@ -4272,10 +4291,10 @@ Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
             o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
             return;\r
         }\r
-        if (res.success === false) {\r
-            this.fireEvent('exception', this, 'remote', action, o, res, rs);\r
-        } else {\r
+        if (res.success === true) {\r
             this.fireEvent('write', this, action, res.data, res, rs, o.request.arg);\r
+        } else {\r
+            this.fireEvent('exception', this, 'remote', action, o, res, rs);\r
         }\r
         // TODO refactor onRead, onWrite to be more generalized now that we're dealing with Ext.data.Response instance\r
         // the calls to request.callback(...) in each will have to be made similar.\r