Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    39
    Vote Rating
    0
    rTankersley is on a distinguished road

      0  

    Default Tree oddities: getChildNodebyId and root.childNodes not working

    Tree oddities: getChildNodebyId and root.childNodes not working


    This simple program should output the tree node where the id is 't1', and the root's child nodes.

    Ext Code:
    Code:
    Ext.require([
        'Ext.data.*',
        'Ext.grid.*',
        'Ext.tree.*'
    ]);
    
    Ext.onReady(function() {
    
    var store = new Ext.data.TreeStore({
        id: 'myStore',
        proxy: {
                type: 'ajax',
                url: 'sysAdminTree.json',
           },
           root: {
                text: 'root',
                id: 'root',
                expanded: true
            },
           autoload: true
    });
    
    Ext.define('myTree', {
        extend: 'Ext.tree.Panel',
        alias: 'widget.myTree',
        id: 'myTree',
        height: 500,
        title: 'Hierarchy',
         layout: 'fit',
         store: store,
          rootVisible: false,
    });
    
    Ext.create('Ext.panel.Panel', {
        title: 'hello',
        id: 'panel',
        items: [{xtype: 'myTree'}] ,
        renderTo: Ext.getBody(),
    });
    
    var getNode = new function()
    {
        var treeStore = Ext.getCmp('myTree').store;
        
        console.log(treeStore.getNodeById('root'));
        console.log(treeStore.tree.root);
        console.log(treeStore.getNodeById('t1'));
        console.log(treeStore.tree.root.childNodes);
    }
    });
    JSON:
    Code:
    [{
        id: 'sa1',
        text: 'sysAdminOne',
        children: [{
            id: 'sm1',
            text: 'siteManagerOne',
            children: [{
                id: 't1',
                text: 'teacherOne',
                children: [{
                    id: 'm1',
                    text: 'moduleOne',
                    children: [{
                        id: 's1',
                        text: 'studentOne',
                        leaf: true
                    }]
                }]
            }]
        }]
    },{
        id: 'sa2',
        text: 'sysAdminTwo',
        children: [{
            id: 'sm2',
            text: 'siteManagerTwo',
            children: [{
                id: 't2',
                text: 'teacherTwo',
                children: [{
                    id: 'm2',
                    text: 'moduleTwo',
                    children: [{
                        id: 's2',
                        text: 'studentTwo',
                        leaf: true
                    }]
                }]
            }]
        }]
    }]
    However, the function does not do what I would expect. The first two console.logs print out both times the root node. However, the next two console.logs are undefined.

    The strangest part is that going through the console, treeStore.tree.root.childNodes IS defined, with three items in it. But when you try to console.log it, it becomes undefined.

  2. #2
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    This is a double post of

    http://www.sencha.com/forum/showthre...Tree-Challenge!

    and has been resolved (not a bug).

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."