Results 1 to 7 of 7

Thread: How to global timeout on Ajax Operations such Store proxy timeouts in Ext JS 5

  1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    36

    Default How to global timeout on Ajax Operations such Store proxy timeouts in Ext JS 5

    Hi

    In Ext JS 4.x, one could set the timeout on all global Ajax operations such as store proxy timeouts with code similar to below

    PHP Code:
    var globalAjaxOpsTimeout 60000//1 minute 
    Ext.Ajax.timeout globalAjaxOpsTimeout  
    Ext
    .override(Ext.form.Basic, { timeoutglobalAjaxOpsTimeout  });
    Ext.override(Ext.data.proxy.Server, { timeout:globalAjaxOpsTimeout });
    Ext.override(Ext.data.Connection, { timeoutglobalAjaxOpsTimeout  }); 
    However, this code does not seem to work entirely in Ext 5.x. My Stores timeout after 30secs even with the code above

    Does anyone know how to set the timeouts globally on all stores in Ext 5

  2. #2
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,339
    Answers
    20

    Default

    timeout is a config on the Proxy class, so this (untested) code should work.

    Code:
    Ext.define('MyProxy', {
        extend: 'Ext.data.proxy.Proxy',
    
    
        config: {
            timeout : 60000
        ...

  3. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    36

    Default

    Hi LesJ

    I've tried you suggestion but it did not work.
    What I did was was

    PHP Code:
    Ext.Ajax.timeout = { config: { timeoutglobalAjaxOpsTimeout} }; 
    Ext.override(Ext.form.Basic, { config :{timeoutglobalAjaxOpsTimeout} });
    Ext.override(Ext.data.proxy.Server, { config: { timeoutglobalAjaxOpsTimeout } });
    Ext.override(Ext.data.Connection, { config: { timeout:globalAjaxOpsTimeout} }); 
    Anymore suggestions?

    Thanks

  4. #4
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,339
    Answers
    20

    Default

    config is done per proxy instance

  5. #5
    Sencha User
    Join Date
    Apr 2013
    Posts
    36

    Default

    Hi, It seems that that only to set the global timeout on ajax proxied stores is to call override method on class Ext.data.proxy.Ajax, like so
    PHP Code:

    //THIS CALL HERE WORKS TO SET A GLOBAL TIMEOUT FOR ALL INSTANCES OF AJAX PROXIED STORES
    Ext.data.proxy.Ajax.override({
                                
    timeout60000
                            
    });

    //THESE SETTINGS HERE DONT SEEM TO WORK FOR ALL INSTANCES OF AJAX PROXIED STORES

    Ext.override(Ext.data.Connection, {
                                
    timeout60000
                            
    });
     
    Ext.override(Ext.data.proxy.Ajax, {
                                
    timeout60000
                            
    }); 
    Is this the right way to set the timeout on ajax proxied stores in Extjs 5??

  6. #6
    Sencha User
    Join Date
    Feb 2015
    Posts
    20

    Default

    Quote Originally Posted by quophyie View Post
    Hi LesJ

    I've tried you suggestion but it did not work.
    What I did was was

    PHP Code:
    Ext.Ajax.timeout = { config: { timeoutglobalAjaxOpsTimeout} }; 
    Ext.override(Ext.form.Basic, { config :{timeoutglobalAjaxOpsTimeout} });
    Ext.override(Ext.data.proxy.Server, { config: { timeoutglobalAjaxOpsTimeout } });
    Ext.override(Ext.data.Connection, { config: { timeout:globalAjaxOpsTimeout} }); 
    Anymore suggestions?

    Thanks
    I see the issue in the code that you posted. You are setting the Ext.Ajax.timeout incorrectly.
    Code:
    Ext.Ajax.setTimeout(globalAjaxOpsTimeout); 
    

    I had the same issue and this setup worked for me.
    Edit: Found another issue. You cant set timeout directly. You must call the setTimeout function.

  7. #7

    Default

    The following worked for me:

    PHP Code:
     var globalAjaxOpsTimeout 60000//1 minute 

            
    Ext.Ajax.setTimeout(globalAjaxOpsTimeout);

            
    Ext.overrideExt.form.Basic, { 
                     
    timeoutExt.Ajax.getTimeout() / 1000
            
    });
            
    Ext.override(Ext.data.proxy.Server, { 
                      
    constructor: function(config) {
                            var 
    me=this;
                            
    config.timeout=Ext.Ajax.getTimeout();
                            
    me.callParent(arguments);
                       }
             });
            
    Ext.override(Ext.data.Connection, { 
                       
    constructor: function(config) {
                            var 
    me=this;
                            
    config.timeout=Ext.Ajax.getTimeout();
                            
    me.callParent(arguments);
                       }
            }); 
    Hope this helps!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •