crp_spaeth
4 May 2009, 5:46 AM
Hi There,
I am playing around with the new Ext.Direct functionalities and I asked myself why you send different Javascript Types in the doSend Function f the remotingProvider.
I really like the possibility to be able to buffer request and send them all at once after a specific time but if enableBuffer is enabled I think doSend should allways send an encoded Array to Server even if Ext asks the server only to execute one Call....
If I add one Record to the Store Ext will post of this string:
{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}],"type":"rpc"
,"tid":3}
But if I Add two Records before the buffertime goes by I and up with that post:
[{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}],"type":"rpc"
,"tid":4},{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}]
,"type":"rpc","tid":5}]
doSend : function(data){
var o = {
url: this.url,
callback: this.onData,
scope: this
};
// send only needed data
var callData;
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
callData.push(this.getCallData(data[i]));
}
}else{
callData = this.getCallData(data);
}
if(this.enableUrlEncode){
var params = {};
params[typeof this.enableUrlEncode == 'string' ? this.enableUrlEncode : 'data'] = Ext.encode(callData);
o.params = params;
}else{
o.jsonData = callData;
}
Ext.Ajax.request(o);
},
I think this would be more consistent if you would add some brackets around this.getCallData(data) in the else block:
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
callData.push(this.getCallData(data[i]));
}
}else{
callData = [ this.getCallData(data) ];
}
I am playing around with the new Ext.Direct functionalities and I asked myself why you send different Javascript Types in the doSend Function f the remotingProvider.
I really like the possibility to be able to buffer request and send them all at once after a specific time but if enableBuffer is enabled I think doSend should allways send an encoded Array to Server even if Ext asks the server only to execute one Call....
If I add one Record to the Store Ext will post of this string:
{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}],"type":"rpc"
,"tid":3}
But if I Add two Records before the buffertime goes by I and up with that post:
[{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}],"type":"rpc"
,"tid":4},{"action":"TestAction","method":"createData","data":[{"email":"d","first":"d","last":"d"}]
,"type":"rpc","tid":5}]
doSend : function(data){
var o = {
url: this.url,
callback: this.onData,
scope: this
};
// send only needed data
var callData;
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
callData.push(this.getCallData(data[i]));
}
}else{
callData = this.getCallData(data);
}
if(this.enableUrlEncode){
var params = {};
params[typeof this.enableUrlEncode == 'string' ? this.enableUrlEncode : 'data'] = Ext.encode(callData);
o.params = params;
}else{
o.jsonData = callData;
}
Ext.Ajax.request(o);
},
I think this would be more consistent if you would add some brackets around this.getCallData(data) in the else block:
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
callData.push(this.getCallData(data[i]));
}
}else{
callData = [ this.getCallData(data) ];
}