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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Can I get a runnable test case?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

Posting Permissions

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