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
    Location
    Lyon, France
    Posts
    205
    Vote Rating
    4
    christophe.geiser will become famous soon enough

      0  

    Default [4.2.0.265] TreeStore.onBeforeExpand

    [4.2.0.265] 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()

    Code:
        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 {
                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;
                        Ext.callback(callback, scope || node, [node.childNodes]);
                    }
                });
            }
        },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Can I get a runnable test case?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

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

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