X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/pkgs/direct-debug.js
diff --git a/pkgs/direct-debug.js b/pkgs/direct-debug.js
index 350ac4fb..3db34916 100644
--- a/pkgs/direct-debug.js
+++ b/pkgs/direct-debug.js
@@ -1,5 +1,5 @@
/*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
@@ -52,31 +52,35 @@ paramOrder: 'param1|param2|param'
switch (action) {
case Ext.data.Api.actions.create:
- args.push(params[reader.meta.root]); // <-- create(Hash)
+ args.push(params.jsonData[reader.meta.root]); // <-- create(Hash)
break;
case Ext.data.Api.actions.read:
- if(this.paramOrder){
- for(var i = 0, len = this.paramOrder.length; i < len; i++){
- args.push(params[this.paramOrder[i]]);
+ // If the method has no parameters, ignore the paramOrder/paramsAsHash.
+ if(directFn.directCfg.method.len > 0){
+ if(this.paramOrder){
+ for(var i = 0, len = this.paramOrder.length; i < len; i++){
+ args.push(params[this.paramOrder[i]]);
+ }
+ }else if(this.paramsAsHash){
+ args.push(params);
}
- }else if(this.paramsAsHash){
- args.push(params);
}
break;
case Ext.data.Api.actions.update:
- args.push(params[reader.meta.idProperty]); // <-- save(Integer/Integer[], Hash/Hash[])
- args.push(params[reader.meta.root]);
+ args.push(params.jsonData[reader.meta.root]); // <-- update(Hash/Hash[])
break;
case Ext.data.Api.actions.destroy:
- args.push(params[reader.meta.root]); // <-- destroy(Int/Int[])
+ args.push(params.jsonData[reader.meta.root]); // <-- destroy(Int/Int[])
break;
}
var trans = {
params : params || {},
- callback : callback,
- scope : scope,
- arg : options,
+ request: {
+ callback : callback,
+ scope : scope,
+ arg : options
+ },
reader: reader
};
@@ -93,7 +97,7 @@ paramOrder: 'param1|param2|param'
this.fireEvent("loadexception", this, trans, res, null);
}
this.fireEvent('exception', this, 'remote', action, trans, res, null);
- trans.callback.call(trans.scope, null, trans.arg, false);
+ trans.request.callback.call(trans.request.scope, null, trans.request.arg, false);
return;
}
if (action === Ext.data.Api.actions.read) {
@@ -120,11 +124,11 @@ paramOrder: 'param1|param2|param'
this.fireEvent("loadexception", this, trans, res, ex);
this.fireEvent('exception', this, 'response', action, trans, res, ex);
- trans.callback.call(trans.scope, null, trans.arg, false);
+ trans.request.callback.call(trans.request.scope, null, trans.request.arg, false);
return;
}
- this.fireEvent("load", this, res, trans.arg);
- trans.callback.call(trans.scope, records, trans.arg, true);
+ this.fireEvent("load", this, res, trans.request.arg);
+ trans.request.callback.call(trans.request.scope, records, trans.request.arg, true);
},
/**
* Callback for write actions
@@ -134,8 +138,9 @@ paramOrder: 'param1|param2|param'
* @private
*/
onWrite : function(action, trans, result, res, rs) {
- this.fireEvent("write", this, action, result, res, rs, trans.arg);
- trans.callback.call(trans.scope, result, res, true);
+ var data = trans.reader.extractData(result);
+ this.fireEvent("write", this, action, data, res, rs, trans.request.arg);
+ trans.request.callback.call(trans.request.scope, data, res, true);
}
});
@@ -850,9 +855,15 @@ TestAction.multiply(
/**
* @cfg {Number} maxRetries
- * Number of times to re-attempt delivery on failure of a call.
+ * Number of times to re-attempt delivery on failure of a call. Defaults to 1.
*/
maxRetries: 1,
+
+ /**
+ * @cfg {Number} timeout
+ * The timeout to use for each request. Defaults to undefined.
+ */
+ timeout: undefined,
constructor : function(config){
Ext.direct.RemotingProvider.superclass.constructor.call(this, config);
@@ -865,7 +876,7 @@ TestAction.multiply(
* @param {Ext.direct.RemotingProvider} provider
* @param {Ext.Direct.Transaction} transaction
*/
- 'beforecall',
+ 'beforecall',
/**
* @event call
* Fires immediately after the request to the server-side is sent. This does
@@ -875,7 +886,7 @@ TestAction.multiply(
*/
'call'
);
- this.namespace = (typeof this.namespace === 'string') ? Ext.ns(this.namespace) : this.namespace || window;
+ this.namespace = (Ext.isString(this.namespace)) ? Ext.ns(this.namespace) : this.namespace || window;
this.transactions = {};
this.callBuffer = [];
},
@@ -884,8 +895,8 @@ TestAction.multiply(
initAPI : function(){
var o = this.actions;
for(var c in o){
- var cls = this.namespace[c] || (this.namespace[c] = {});
- var ms = o[c];
+ var cls = this.namespace[c] || (this.namespace[c] = {}),
+ ms = o[c];
for(var i = 0, len = ms.length; i < len; i++){
var m = ms[i];
cls[m.name] = this.createMethod(c, m);
@@ -919,8 +930,8 @@ TestAction.multiply(
if(success){
var events = this.getEvents(xhr);
for(var i = 0, len = events.length; i < len; i++){
- var e = events[i];
- var t = this.getTransaction(e);
+ var e = events[i],
+ t = this.getTransaction(e);
this.fireEvent('data', this, e);
if(t){
this.doCallback(t, e, true);
@@ -966,11 +977,10 @@ TestAction.multiply(
url: this.url,
callback: this.onData,
scope: this,
- ts: data
- };
+ ts: data,
+ timeout: this.timeout
+ }, callData;
- // send only needed data
- var callData;
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
@@ -982,7 +992,7 @@ TestAction.multiply(
if(this.enableUrlEncode){
var params = {};
- params[typeof this.enableUrlEncode == 'string' ? this.enableUrlEncode : 'data'] = Ext.encode(callData);
+ params[Ext.isString(this.enableUrlEncode) ? this.enableUrlEncode : 'data'] = Ext.encode(callData);
o.params = params;
}else{
o.jsonData = callData;
@@ -1008,7 +1018,7 @@ TestAction.multiply(
if(!this.callTask){
this.callTask = new Ext.util.DelayedTask(this.combineAndSend, this);
}
- this.callTask.delay(typeof this.enableBuffer == 'number' ? this.enableBuffer : 10);
+ this.callTask.delay(Ext.isNumber(this.enableBuffer) ? this.enableBuffer : 10);
}else{
this.combineAndSend();
}
@@ -1107,8 +1117,8 @@ TestAction.multiply(
doCallback: function(t, e){
var fn = e.status ? 'success' : 'failure';
if(t && t.cb){
- var hs = t.cb;
- var result = e.result || e.data;
+ var hs = t.cb,
+ result = Ext.isDefined(e.result) ? e.result : e.data;
if(Ext.isFunction(hs)){
hs(result, e);
} else{