static/ext/src/data/TreeStore.js
function(node, callback, scope, args) {
        var me = this,
            reader, dataRoot, data,
            callbackArgs;
        
        // Children are loaded go ahead with expand
        if (node.isLoaded()) {
            callbackArgs = [node.childNodes];
            if (args) {
                callbackArgs.push.apply(callbackArgs, args);
            }
            Ext.callback(callback, scope || node, callbackArgs);
        }
        // There are unloaded child nodes in the raw data because of the lazy configuration, load them then call back.
        else if (dataRoot = (data = (node.raw || node[node.persistenceProperty])[(reader = me.getProxy().getReader()).root])) {
            me.fillNode(node, reader.extractData(dataRoot));
            delete data[reader.root];
            callbackArgs = [node.childNodes];
            if (args) {
                callbackArgs.push.apply(callbackArgs, args);
            }
            Ext.callback(callback, scope || node, callbackArgs);
        }
        // The node is loading
        else if (node.isLoading()) {
            me.on('load', function() {
                callbackArgs = [node.childNodes];
                if (args) {
                    callbackArgs.push.apply(callbackArgs, args);
                }
                Ext.callback(callback, scope || node, callbackArgs);
            }, me, {single: true});
        }
        // Node needs loading
        else {
            me.read({
                node: node,
                callback: function() {
                    // Clear the callback, since if we're introducing a custom one,
                    // it may be re-used on reload
                    delete me.lastOptions.callback;
                    callbackArgs = [node.childNodes];
                    if (args) {
                        callbackArgs.push.apply(callbackArgs, args);
                    }
                    Ext.callback(callback, scope || node, callbackArgs);
                }
            });
        }
    }
function(node, callback, scope, args) {
        var me = this,
            reader, dataRoot, data,
            callbackArgs;
        
        // Children are loaded go ahead with expand
        if (node.isLoaded()) {
            callbackArgs = [node.childNodes];
            if (args) {
                callbackArgs.push.apply(callbackArgs, args);
            }
            Ext.callback(callback, scope || node, callbackArgs);
        }
        // There are unloaded child nodes in the raw data because of the lazy configuration, load them then call back.
        else if (dataRoot = (data = (node.raw || node[node.persistenceProperty])[(reader = me.getProxy().getReader()).root])) {
            me.fillNode(node, reader.extractData(dataRoot));
            delete data[reader.root];
            callbackArgs = [node.childNodes];
            if (args) {
                callbackArgs.push.apply(callbackArgs, args);
            }
            Ext.callback(callback, scope || node, callbackArgs);
        }
        // The node is loading
        else if (node.isLoading()) {
            me.on('load', function() {
                callbackArgs = [node.childNodes];
                if (args) {
                    callbackArgs.push.apply(callbackArgs, args);
                }
                Ext.callback(callback, scope || node, callbackArgs);
            }, me, {single: true});
        }
        // Node needs loading
        else {
            me.read({
                node: node,
                callback: function() {
                    // Clear the callback, since if we're introducing a custom one,
                    // it may be re-used on reload
                    delete me.lastOptions.callback;
                    callbackArgs = [node.childNodes];
                    if (args) {
                        callbackArgs.push.apply(callbackArgs, args);
                    }
                    Ext.callback(callback, scope || node, callbackArgs);
                }
            });
        }
    }
function ( node , callback , scope , args ) { var me = this , reader , dataRoot , data , callbackArgs ; // Children are loaded go ahead with expand if ( node . isLoaded ( ) ) { callbackArgs = [ node . childNodes ] ; if ( args ) { callbackArgs . push . apply ( callbackArgs , args ) ; } Ext . callback ( callback , scope || node , callbackArgs ) ; } // There are unloaded child nodes in the raw data because of the lazy configuration, load them then call back. else if ( dataRoot = ( data = ( node . raw || node [ node . persistenceProperty ] ) [ ( reader = me . getProxy ( ) . getReader ( ) ) . root ] ) ) { me . fillNode ( node , reader . extractData ( dataRoot ) ) ; delete data [ reader . root ] ; callbackArgs = [ node . childNodes ] ; if ( args ) { callbackArgs . push . apply ( callbackArgs , args ) ; } Ext . callback ( callback , scope || node , callbackArgs ) ; } // The node is loading else if ( node . isLoading ( ) ) { me . on ( 'load' , function ( ) { callbackArgs = [ node . childNodes ] ; if ( args ) { callbackArgs . push . apply ( callbackArgs , args ) ; } Ext . callback ( callback , scope || node , callbackArgs ) ; } , me , { single : true } ) ; } // Node needs loading else { me . read ( { node : node , callback : function ( ) { // Clear the callback, since if we're introducing a custom one, // it may be re-used on reload delete me . lastOptions . callback ; callbackArgs = [ node . childNodes ] ; if ( args ) { callbackArgs . push . apply ( callbackArgs , args ) ; } Ext . callback ( callback , scope || node , callbackArgs ) ; } } ) ; } }
Fired by the root node.

Called before a node is expanded.

This ensures that the child nodes are available before calling the passed callback.
@private
@param {Ext.data.NodeInterface} node The node being expanded.
@param {Function} callback The function to run after the expand finishes
@param {Object} scope The scope in which to run the callback function
@param {Array} args The extra args to pass to the callback after the new child nodes
Fired by the root node .