[CLOSED] Ext.NetServiceTreeLoader processResponse override does not implement loader.load() signature with scope parameter?

  1. #1

    [CLOSED] Ext.NetServiceTreeLoader processResponse override does not implement loader.load() signature with scope parameter?

    I noticed that when was adding a callback to the load() call off the web services tree loader object that the scope param I supplied was not being applied.
    
    // @source core/tree/WebServiceTreeLoader.js
    
    
    Ext.NetServiceTreeLoader = Ext.extend(Ext.tree.TreeLoader, {
        // private override
        processResponse : function (response, node, callback) {
            var json,
                root;
            
            if (this.json) {        
                root = Ext.decode(response.responseText);
                json = root.d || root;
            } else {
                var xmlData = response.responseXML;
                
                root = xmlData.documentElement || xmlData;                
                json = Ext.DomQuery.selectValue("json", root, "");        
            }
            
    
    
            try {
                var o = Ext.isString(json) ? eval("(" + json + ")") : json,
                    i = 0,
                    len;
                
                node.beginUpdate();
                
                for (i, len = o.length; i < len; i++) {
                    var n = this.createNode(o[i]);
    
    
                    if (n) {
                        node.appendChild(n);
                    }
                }
                
                node.endUpdate();
                
                if (typeof callback === "function") {
                    callback(this, node);
                }
            } catch (e) {
                this.handleFailure(response);
            }
        }
    });
    I updated the source to this .. I hope I got it right. If not, can the scope param be added and SVN updated?
    
    // @source core/tree/WebServiceTreeLoader.js
    
    
    Ext.NetServiceTreeLoader = Ext.extend(Ext.tree.TreeLoader, {
        // private override
        processResponse : function (response, node, callback, scope) {
            var json,
                root;
            
            if (this.json) {        
                root = Ext.decode(response.responseText);
                json = root.d || root;
            } else {
                var xmlData = response.responseXML;
                
                root = xmlData.documentElement || xmlData;                
                json = Ext.DomQuery.selectValue("json", root, "");        
            }
            
    
    
            try {
                var o = Ext.isString(json) ? eval("(" + json + ")") : json,
                    i = 0,
                    len;
                
                node.beginUpdate();
                
                for (i, len = o.length; i < len; i++) {
                    var n = this.createNode(o[i]);
    
    
                    if (n) {
                        node.appendChild(n);
                    }
                }
                
                node.endUpdate();
    
    
                this.runCallback(callback, scope || node, []);
    
    
            } catch (e) {
                this.handleFailure(response);
            }
        }
    });
    runCallback() seemed to do a type check on the object to see if the callback was a function, so I removed the type check in lieu of runCallback().
    Last edited by Daniil; Apr 27, 2012 at 11:40 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Thanks for the report. It has been fixed in SVN, revision #3964.
  3. #3
    Thank you!

Similar Threads

  1. [CLOSED] Getting the parameter defined in ext:Window Loader
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 17, 2012, 1:27 PM
  2. TreePanel - load root with loader
    By pintun in forum 1.x Help
    Replies: 2
    Last Post: Apr 14, 2010, 8:19 PM
  3. Replies: 4
    Last Post: Jan 27, 2010, 9:55 AM
  4. [CLOSED] Function signature when using Fn
    By jchau in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 29, 2009, 5:41 PM
  5. window.Load encodes url parameter
    By thedarklord in forum 1.x Help
    Replies: 5
    Last Post: May 30, 2009, 12:13 PM

Tags for this Thread

Posting Permissions