geographika
geographika

Reputation: 6528

Using Ext.data.Connection for a Form Load Action

I have created a custom extension of Ext.data.Connection that adds in a couple of headers for all my Ajax requests.

I'd like to use the same Connection class to submit a form similar to below, but it seems the http://www.sencha.com/deploy/dev/docs/?class=Ext.form.Action has its own configuration.

    var conn = new MyCustom.Request({
        method: 'GET',
        endpoint: this.routeGetURI + this.routeid,
        failure: function(form, action){
            Ext.Msg.alert("Load failed", action.result);
        },
        success: this.fillFormValues

    });

    this.getForm().load(conn);

Is there simple way to force the form to use my connection object?

Upvotes: 0

Views: 947

Answers (1)

Brian Moeskau
Brian Moeskau

Reputation: 20431

Instead of subclassing Connection, have you tried simply adding your default headers to the global Ext.Ajax singleton? The form Action classes use that singleton under the covers, so you should be able to simply do something like this:

Ext.Ajax.defaultHeaders = {
    'my-header': 'foo',
    'another': 'bar'
};

Upvotes: 1

Related Questions