Results 1 to 2 of 2

Thread: [] TreeStore.onBeforeExpand

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Nov 2008
    Lyon, France
    Vote Rating

    Default [] TreeStore.onBeforeExpand

    Took me a while to find the culprit.

    Few thing with this method:

    1- the return value of (node.raw || node[node.persistenceProperty])[(reader = me.getProxy().getReader()).root]) is likely to be "true". You then try to evaluate me.fillNode(node, reader.extractData(true)), which does not make a lot of sense (we should have childNodes instead here).
    2- As the return value of above is truthly, elseif (node.isLoading()) {... is never called. That can be problematic - at least was with my code.
    3- With the current configuation, sames nodes can be loaded multiple times. We might need a return if node.isLoaded()

        onBeforeNodeExpand: function(node, callback, scope) {
            var me = this,
                reader, dataRoot, data;
            // Children are loaded go ahead with expand
            if (node.isLoaded()) {
                Ext.callback(callback, scope || node, [node.childNodes]);
            } else if (node.childRecords) {
            // 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];
                Ext.callback(callback, scope || node, [node.childNodes]);
            //else if (node.isLoading()) {
    if (node.isLoading()) {
                me.on('load', function() {
                    Ext.callback(callback, scope || node, [node.childNodes]);
                }, me, {single: true});
            else {
                    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;
                        Ext.callback(callback, scope || node, [node.childNodes]);

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Can I get a runnable test case?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts