Learn More... SQLsnap Logo. SQLsnap Screenshot. Buy Now or Learn More!

Extend Ext Grid Timeout

February 18th, 2010

In my last post, I showed how to extend the timeout for an Ext.Ajax.request({…}); request.

Extending the timeout for other Ext objects is not so simple. For grids needing information from the server, you will have to use a connection object and reference it in the datastore via an HttpProxy Object. Take a look at this connection object.


  var conn = new Ext.data.Connection({
            url: "/myurl.do",
            method: "POST",
            timeout:180000,
            baseParams:{
                cust: "555",
                state: "TN",
                start: 0
            }
        });

Note that we have extended the timeout to 180000 (3 minutes).

This encapsulates everything about the ajax request, including the timeout value. Now that we have this connection object, we can pass it to basically anything and it will be used in place of the defaults and in our case we our interested in extending the 30 second default timeout for an Ext grid. The connection object is useful elsewhere as well.

Here is an example datastore object that can use the connection object:

var myDataStore = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy(conn),
    reader: new Ext.data.JsonReader({
        root: 'myDataArray',
        totalProperty: 'totalCount',
        fields: [
            {
                name: 'field1'
            },
            {
                name: 'field2'
            }
        ]
    })
});

So in this case, this datastore is is wrapped around a JsonReader for the purpose of loading a grid.

The grid would reference the datastore which references the connection.

Scott


Posted in: Extjs 3.
Subscribe: RSS 2.0 feed.

  • Scott

    Thanks. This solved my problem.

blog comments powered by Disqus
  • « Older Entries
  • Newer Entries »