Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2007
    Posts
    59
    Vote Rating
    0
    ftftft is on a distinguished road

      0  

    Default [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)
    Code:
        
    doAction : function(action, options){
            if(typeof action == 'string'){
                action = new Ext.form.Action.ACTION_TYPES[action](this, options);
            }
    Action.js: (o.timeout = 40. but was never passed to Ext.Ajax.request).
    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);
            }
    so, when go to ext-base.js, callback.timeout is always 30000, set by default.
    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);
                }

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,509
    Vote Rating
    374
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Hmmm,

    what I read in the source:

    PHP Code:
        // private
        
    createCallback : function(){
            return {
                
    successthis.success,
                
    failurethis.failure,
                
    scopethis,
                
    timeout: (this.form.timeout*1000),
                
    uploadthis.form.fileUpload this.success undefined
            
    };
        } 
    and
    PHP Code:
       // private
        
    run : function(){
            var 
    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),
                    
    methodmethod,
                    
    params:isPost this.getParams() : null,
                    
    isUploadthis.form.fileUpload
                
    }));

            }else if (
    o.clientValidation !== false){ // client validation failed
                
    this.failureType Ext.form.Action.CLIENT_INVALID;
                
    this.form.afterAction(thisfalse);
            }
        }, 
    This is source from svn rev. 1344.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #3
    Sencha Premium Member
    Join Date
    Jun 2007
    Posts
    59
    Vote Rating
    0
    ftftft is on a distinguished road

      0  

    Default


    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.  
                };

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2007
    Posts
    59
    Vote Rating
    0
    ftftft is on a distinguished road

      0  

    Default


    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
            };
        }

  5. #5
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,509
    Vote Rating
    374
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    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

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #6
    Sencha Premium Member
    Join Date
    Jun 2007
    Posts
    59
    Vote Rating
    0
    ftftft is on a distinguished road

      0  

    Default


    My code is like below. Both "timeout" parameter are ignored.

    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
            }
        );
    more comments. timeout at Ext.data.Connection is a Constants at 30000(Aka. 30 seconds).

    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);
                }