Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I override the Ext JS JsonStore timeout?

Tags:

json

extjs

I have a JsonStore that needs to return from an HTTP request that takes longer than 30 seconds.

Setting the "timeout" property on either the JsonStore config doesn't override the 30-second timeout, neither does setting a proxy (rather than just setting the url property) and putting a timeout on the proxy.

How can I extend this timeout?

(I'm using Ext JS 3.1.1)

var ds = new Ext.data.JsonStore({
    autoSave:       true,
    method:         "POST",
    /*url:          "search-ajax.aspx",
    timeout:        120000,*/
    root:           "rows",
    totalProperty:  "results",
    idProperty:     "primarykeyvalue",
    proxy:      new Ext.data.HttpProxy({ url: "search-ajax.aspx", timeout: 120000 }),
    fields:     previewColumnConfig,
    baseParams: {
        Command:    "",
        ID:     primaryKeyValue,
        Entity: entityFullName,
        vetype: ValidationEntityType,
        vepk:       ValidationEntityPK,
        now:        (new Date()).getTime()
        },
    writer: new Ext.data.JsonWriter({
        encode:     true,
        listful:    false
        })
    });
like image 759
richardtallent Avatar asked Feb 12 '10 17:02

richardtallent


1 Answers

If you want the timeout to be the same across your entire app, set it globally on the Ext.Ajax singleton.

Ext.Ajax.timeout = 120000; //2 minutes

If you want the timeout to be set differently only on a single request, you'll need to define the HttpProxy in a var and modify one of it's properties before passing it into the JsonStore config. The conn property takes options to be used for that request only.

var proxy = new Ext.data.HttpProxy({ url: "search-ajax.aspx" });
proxy.conn = { timeout: 120000 };
like image 154
Jonathan Julian Avatar answered Oct 11 '22 19:10

Jonathan Julian