1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    Answers
    2
    jim@carroll.net is on a distinguished road

      0  

    Default Answered: SERIOUS BUG: reload of Ext.data.TreeStore causes TypeError: 'null' is not an object (

    Answered: SERIOUS BUG: reload of Ext.data.TreeStore causes TypeError: 'null' is not an object (


    We are running ExtJS version 4.1.3

    We have an app that uses an Ext.panel.Tree with the store loaded from a remote Xml source. All seemed well during development. But we eventually realized there was a problem when the panel was reloaded a second time. What kept us from realizing there was an issue was that it only happens the second time we reloaded the TreeStore.

    On the second call to store.load(), we get the following from Chrome and Safari:

    1.
    Uncaught TypeError: Cannot call method 'indexOf' of null ext-all-dev.js:164027
    1. Ext.define.onBeforeFillext-all-dev.js:164027
    2. Ext.define.fireext-all-dev.js:14999
    3. continueFireEventext-all-dev.js:28029
    4. fireEventext-all-dev.js:28000
    5. Ext.define.fillNodeext-all-dev.js:96156
    6. Ext.define.onProxyLoadext-all-dev.js:96205
    7. Ext.define.processResponseext-all-dev.js:87982
    8. (anonymous function)ext-all-dev.js:88471
    9. Ext.apply.callbackext-all-dev.js:11434
    10. Ext.define.onCompleteext-all-dev.js:37132
    11. Ext.define.onStateChangeext-all-dev.js:37069
    12. (anonymous function)ext-all-dev.js:3000
    On the surface, it would appear to the same issue reported here:

    http://www.mysamplecode.com/2012/03/extjs-4-reload-tree-node-error.html


    We have tried both work arounds recommended in this article, but neither had any effect (actually, the replacement for load appears to fail completely under ExtJS 4.1.3 – which I suspect is because it was intended for an earlier edition of 4.1).

    A little architecture of our app may be in order. The Tree panel is displayed in a pop-up window. The window uses a ‘card’ layout and the Tree panel is the third card.

    We have a controller action that that runs when the event ‘show’ is fired for the third card. It is in that controller action that we make our call to the Tree store load(), that looks like this:

    Code:
    show: function(abstractcomponent, options) {
        var ctrl = this;
        var proxy = ctrl.getFolderListStore().getProxy();
        proxy.setExtraParam(‘myparam’, ‘param1’);
        ctrl. getFolderListStore ().load();
    }
    Our TreeStore is defined as

    Code:
    Ext.define('CCPL.store.FolderList', {
        extend: 'Ext.data.TreeStore',
     
        requires: [
            'CCPL.model.Folder'
        ],
     
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: false,
                storeId: 'FolderListStore',
                model: 'CCPL.model.Folder'
            }, cfg)]);
            }
    });
    Our Model is defined as:

    Code:
    Ext.define('CCPL.model.Folder', {
    extend: 'Ext.data.Model',
     
    idProperty: 'id',
     
    fields: [
        {
            name: 'id'
        },
        {
            name: 'text'
        },
        {
            convert: function(v, rec) {
                if (this.useNull && (v === undefined || v === null || v === '')) {
                    return null;
                }
                return v === true || /true/i.test(v) || v == 1;
            },
            name: 'leaf',
            type: 'boolean'
        },
        {
            name: 'checked',
            defaultValue: false
        }
    ],
    proxy: {
        type: 'ajax',
        url: '/action/get_folder_list/',
        reader: {
            type: 'xml',
            root: 'folderlist',
            record: 'folder'
            }
        }
    });
    The Tree panel displays fine on the first time around. We close the window, then re-open the window, and when we invoke the load() call a second time, BAM, the error message get’s tossed.

    We’ve also tried running it in Firefox with Firebug, but the error message is much less useful:

    "Resuming debugger: error during debugging loop: TypeError: firstViewRangeElement is null"
    TypeError: store is null
    [Break On This Error]
    (164027 out of range 151528) ext-all-dev.js (line 164027
    Any help we be greatly appreciated. We are at our wits end with this one!

  2. In case anyone runs into this same issue, I can confirm it is fixed in ExtJS 4.2 Sprint 2 which you can download as a Beta from http://www.sencha.com/forum/showthre...-Now-Available

    If for some reason you cannot upgrade ExtJS, and you'd prefer to fix you installation, you can manually apply the path we posted http://www.sencha.com/forum/showthre...ch-attached%29

    PATCH: http://www.sencha.com/forum/attachme...2&d=1360255225

  3. #2
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    Answers
    2
    jim@carroll.net is on a distinguished road

      0  

    Default Fixed -- ExtJs 4.2 Sprint 2

    Fixed -- ExtJs 4.2 Sprint 2


    In case anyone runs into this same issue, I can confirm it is fixed in ExtJS 4.2 Sprint 2 which you can download as a Beta from http://www.sencha.com/forum/showthre...-Now-Available

    If for some reason you cannot upgrade ExtJS, and you'd prefer to fix you installation, you can manually apply the path we posted http://www.sencha.com/forum/showthre...ch-attached%29

    PATCH: http://www.sencha.com/forum/attachme...2&d=1360255225