1. #1
    Ext User
    Join Date
    Jul 2010
    Posts
    12
    Vote Rating
    0
    EXTOmega is on a distinguished road

      0  

    Default TreePanel accept header

    TreePanel accept header


    Is there any way to specify headers (specifically, the accept header) with a treepanel?

    I do not wish to override the headers used globally with EXT, just the ones specifically for an instance of treepanel.

    Thanks for the help!

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,545
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Clear language: Are you talking about HTTP headers?

    You will have to extend Ext.tree.TreeLoader, and implement your own requestData method.

    IMHO, this method should be fully documented so that people can plug in their own imlpementations easily. It's not difficult though, just take a look at the source.

  3. #3
    Ext User
    Join Date
    Jul 2010
    Posts
    12
    Vote Rating
    0
    EXTOmega is on a distinguished road

      0  

    Default


    Hmm. I'm a bit confused.

    Other components allow me to specify headers as an object. Is there any way I can do this without extending the class? Maybe just by decorating it or overriding some aspect of it?

    Just trying to look for the simplest solution...

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,545
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    OK, now I'm confused. What other components allow you to specify headers as an object? Just so I understand what you mean.

  5. #5
    Ext User
    Join Date
    Jul 2010
    Posts
    12
    Vote Rating
    0
    EXTOmega is on a distinguished road

      0  

    Default


    myForm.getForm().load({
    method: "GET",
    url: "MyURL",
    success : function() {
    pageEditor.el.unmask();
    },
    // Specify custom headers.
    headers: {
    // Inform the server that we're saving as part of an ext-js FormPanel object's lifecycle.
    "Accept": "blah/blahblahblah"
    }
    });

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,545
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Right, extend and override this

    Code:
        requestData : function(node, callback, scope){
            if(this.fireEvent("beforeload", this, node, callback) !== false){
                if(this.directFn){
                    var args = this.getParams(node);
                    args.push(this.processDirectResponse.createDelegate(this, [{callback: callback, node: node, scope: scope}], true));
                    this.directFn.apply(window, args);
                }else{
                    this.transId = Ext.Ajax.request({
                        method:this.requestMethod,
                        url: this.dataUrl||this.url,
                        success: this.handleResponse,
                        failure: this.handleFailure,
                        scope: this,
                        argument: {callback: callback, node: node, scope: scope},
                        params: this.getParams(node)
                    });
                }
            }else{
                // if the load is cancelled, make sure we notify
                // the node that we are done
                this.runCallback(callback, scope || node, []);
            }
        },

  7. #7
    Ext User
    Join Date
    Jul 2010
    Posts
    12
    Vote Rating
    0
    EXTOmega is on a distinguished road

      0  

    Default


    How or where exactly would I put this code?

    Also, bear in mind the example I gave you was for a FormPanel as an example. I want to add an HTTP accept-header to a TreePanel's async request.

Similar Threads

  1. [2.x/3.x] Not accept the choice of 18,19 dates
    By Fabyo in forum Ext 2.x: Bugs
    Replies: 2
    Last Post: 25 Sep 2009, 7:56 AM
  2. Can TimeField accept any value not in its store?
    By taocore in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 30 Jul 2009, 9:13 PM
  3. Can a NestedLayoutPanel accept a toolbar?
    By manxomfoe in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 31 Oct 2006, 5:19 PM

Thread Participants: 1