Hybrid View
-
30 Oct 2007 10:11 AM #1
[2.0b1/rc1][SOLVED] timeout at BasicForm never used
[2.0b1/rc1][SOLVED] timeout at BasicForm never used
I guess it is a bug at Ext code. Regardless what value I set to timeout, it is always 30 seconds.
BasicForm.js: (action='submit', options.timeout=40)
Action.js: (o.timeout = 40. but was never passed to Ext.Ajax.request).Code:doAction : function(action, options){ if(typeof action == 'string'){ action = new Ext.form.Action.ACTION_TYPES[action](this, options); }
so, when go to ext-base.js, callback.timeout is always 30000, set by default.Code:run : function(){ var o = this.options; var method = this.getMethod(); var isPost = method == 'POST'; if(o.clientValidation === false || this.form.isValid()){ Ext.Ajax.request(Ext.apply(this.createCallback(), { form:this.form.el.dom, url:this.getUrl(!isPost), method: method, params:isPost ? this.getParams() : null, isUpload: this.form.fileUpload })); }else if (o.clientValidation !== false){ // client validation failed this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); }
Code:handleReadyState:function(o, callback) { var oConn = this; if (callback && callback.timeout) { this.timeout[o.tId] = window.setTimeout(function() { oConn.abort(o, callback, true); }, callback.timeout); }
-
30 Oct 2007 2:03 PM #2
Hmmm,
what I read in the source:
andPHP Code:// private
createCallback : function(){
return {
success: this.success,
failure: this.failure,
scope: this,
timeout: (this.form.timeout*1000),
upload: this.form.fileUpload ? this.success : undefined
};
}
This is source from svn rev. 1344.PHP Code:// private
run : function(){
var o = this.options;
var method = this.getMethod();
var isPost = method == 'POST';
if(o.clientValidation === false || this.form.isValid()){
Ext.Ajax.request(Ext.apply(this.createCallback(), {
form:this.form.el.dom,
url:this.getUrl(!isPost),
method: method,
params:isPost ? this.getParams() : null,
isUpload: this.form.fileUpload
}));
}else if (o.clientValidation !== false){ // client validation failed
this.failureType = Ext.form.Action.CLIENT_INVALID;
this.form.afterAction(this, false);
}
},
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
1 Nov 2007 6:35 AM #3
Well. Let me go through code at SVN 1350.
Ext.data.Connection. Eventually, timeout is set to here.
Code:Ext.extend(Ext.data.Connection, Ext.util.Observable, { timeout : 30000, request : function(o){ var cb = { success: this.handleResponse, failure: this.handleFailure, scope: this, argument: {options: o}, timeout : this.timeout --> That would be 30000, regardless what timeout value to be set in the form. };
-
1 Nov 2007 6:45 AM #4
Even this code has some problem. If I call,
this.formPanel.getForm().submit({timeout: ....}). the "timeout" value here would never be used.
Code:// private createCallback : function(){ return { success: this.success, failure: this.failure, scope: this, timeout: (this.form.timeout*1000), upload: this.form.fileUpload ? this.success : undefined }; }
-
2 Nov 2007 4:52 AM #5
Here you pass timeout in submit call config object. What if you assign a timeout at the FormPanel construction time as config option, still ignored?
Docs say it's config option of BasicForm.Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
2 Nov 2007 4:59 AM #6
My code is like below. Both "timeout" parameter are ignored.
more comments. timeout at Ext.data.Connection is a Constants at 30000(Aka. 30 seconds).Code:this.filterForm = new Ext.FormPanel({ url:'....', timeout: 400, } this.filterForm.getForm().submit( { waitMsg: 'Retrieving transactions...', success: this.onLoadSuccess, failure: displayFailureMessage, timeout: 400, scope: this } );
At, Ext.data.Connection. var cb = { time: this.timeout} -> 30000
Goto Ext.lib.Ajax
Code:handleReadyState:function(o, callback) { var oConn = this; if (callback && callback.timeout) { --> callback.timeout is cb.timeout at Ext.data.Connection put alert(callback.timeout) for a quick check. this.timeout[o.tId] = window.setTimeout(function() { oConn.abort(o, callback, true); }, callback.timeout); }


Reply With Quote