1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    Philbo is on a distinguished road

      0  

    Default Unanswered: Treegrid: a[b] is undefined (Error Message)

    Unanswered: Treegrid: a[b] is undefined (Error Message)


    Hi Guys,

    I am new to ExtJS and I am playing around for evaluation purposes at work.

    I do wanted to create a Treegrid in a Tab, but however if I send the ajax Request to my url I do get an Javascript error message in Firebug (this only happens if i do want to expand an tree node, first load works finde (to initialize the grid)). The JSON Array should also be OK, otherwise it wouldnt initialize the Grid.

    Error Message:
    Code:
    a[b] is undefined
    (in ext-all.js)

    The Code:
    Code:
    Ext.require([
        'Ext.tab.*',
        'Ext.data.*',
        'Ext.tip.*',
    ]);
    
    Ext.onReady(function(){
        /*
         * Models
         */
        Ext.define('CatList', {
            extend: 'Ext.data.Model',
            fields: [
                {name: 'name',             type: 'string'},
                {name: 'archiviert',     type: 'int'},
                {name: 'id',             type: 'string'}
            ]
        });
        
        //TreeStore
        var catStore = Ext.create('Ext.data.TreeStore', {
            model: 'CatList',
            defaultRootProperty: 'uid',
            proxy: {
                type: 'ajax',
                url: '/testing/extJS/rezeptverwaltung/rezepte.php',
                // reader: {
                    // type: 'json',
                    // root: 'catArr'
                // }
            },
            root: {
                id: '0',
                nodeType: 'async',
                expanded: true,
                text: 'name'                        //???
            },                                                    
            folderSort: true,
            // defaultRootId: 'root',            //Selbe wie root => id
            parentField: 'id',      
        });
           
        //Liste
        var CatListTree = Ext.create('Ext.tree.Panel', {
            title: 'Kategorien',
            width: 500,
            height: 300,
            collapsible: true,
            useArrows: true,
            rootVisible: false,
            store: catStore,
            multiSelect: true,
            singleExpand: true,
            columns: [{
                text: 'ID',
                flex: 1,
                dataIndex: 'id',
                sortable: true
            },{
                xtype: 'treecolumn', //this is so we know which column will show the tree
                text: 'Kategorie',
                flex: 12,
                sortable: true,
                dataIndex: 'name',
            },{
                text: 'Archiviert',
                flex: 4,
                dataIndex: 'archiviert',
                sortable: true
            }]
        });    
        
        //Tabs
        var tabs = Ext.create('Ext.tab.Panel', {
            renderTo: 'tabPanel',
            width: 450,
            activeTab: 0,
            defaults :{
                bodyPadding: 10,
                autoScroll: true
            },
            items: CatListTree
        });   
    });
    Hope you guys can help me!

    Thank you very much!

    Greetings,

    Philipp

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Answers
    541
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    For debugging try using ext-all-debug.js instead of ext-all.js. That way you'll get more meaningful error messages and usable line numbers. Use Firebug or the Chrome Developer Tools to capture a stacktrace for your error and dig into the lines in the stacktrace to try to understand what is going wrong.

    If you can't figure it out for yourself then the following information would help us to help you:
    1. Error message when using ext-all-debug.js.
    2. Full stracktrace, with line numbers.
    3. Exact ExtJS version.
    4. Does the Ajax request actually happen? If it does, could you post an example response?
    5. Which browsers have you tested (make sure you've tried multiple)?

    You have a lot of stray commas in your code but I don't think they're causing this error.

    I'm pretty suspicious of this line but I can't say for sure that it's wrong without having seen your JSON:

    Code:
    defaultRootProperty: 'uid',

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    Philbo is on a distinguished road

      0  

    Default


    Hey!

    Thank you very much for your answer. Ok i hoped, that there are better error messages in ext-js. Thank you very much for the tip.

    However, i have already solved my problem.

    The Ajax Request happens and i do get a JSON Array back . The problem was, that the Ajax Request had static data (it always returned the same array) and it seems like, that ExtJS couldnt handle the multiple IDs in its loaded data. Could that be possible?

    First load worked i had my JSON Array in the Treegrid, but the second request on hitting a Tree Tuple returned an error (but Ajax Request worked and it was the same Array).

    However i have solved the problem, thank you very much.

    Greetings Philipp

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    3
    Vote Rating
    0
    Miller_huang is on a distinguished road

      0  

    Default


    Hi Philbo!

    can you share that how did you solve the problem?

    Thank you!

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Location
    Noida
    Posts
    7
    Vote Rating
    0
    srinivasan1987 is on a distinguished road

      0  

    Default Solution completely based on our Tree store information

    Solution completely based on our Tree store information


    Hi all,

    My suggestion for this issue is "Provide proper data for tree store". Actually i found the reason for this issue is some of my tree store child "id" information is coming as empty. So try to avoid the information without proper "id" information.

  6. #6
    Sencha User
    Join Date
    Nov 2012
    Location
    Noida
    Posts
    7
    Vote Rating
    0
    srinivasan1987 is on a distinguished road

      0  

    Default


    Hi Skirtle,

    I solved this issue by checking my JSON object. Actually some of the Treestore Child's don't have id information. After removing those childs from my tree store, i don't find above error in my page.My tree view panel also working fine. Above information which was provided by you is not suits my ExtJS(4.1) version. Let me know how to enable debug option in 4.1 version.

  7. #7
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,593
    Answers
    541
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Quote Originally Posted by srinivasan1987 View Post
    Above information which was provided by you is not suits my ExtJS(4.1) version. Let me know how to enable debug option in 4.1 version.
    I don't know what you mean. I believe the only advice I gave in this area was to use ext-all-debug.js instead of ext-all.js for debugging, which is just as true in 4.1 as it was in 4.0. The only thing I would add to that is that ext-all-dev.js is actually even better for debugging as it contains some extra warning logging.