2

I use a simple treepanel for my application, and sometimes it stops expanding and unexpanding nodes with the next error:

records[i] is undefined
http://localhost:8080/extjs/ext-all-debug.js
Line 58763

My code is quite simple:

var tree_store = Ext.create('Ext.data.TreeStore', {
    id: 'tree_store_id',
    proxy: {
        type: 'ajax',
        url: 'tree_data.json?object_id=' + Ext.getCmp('object_id').value
    },
    root: {
        text: 'Парки',
        id: 'objectId',
        expanded: true,
        iconCls: 'tree-cls-root'
    }
});

var tree = Ext.create('Ext.tree.Panel', {
    id: 'stock_tree_id',
    store: tree_store,
    autoWidth: true,
    height: 600,
    autoScroll: true,
    renderTo: document.getElementById('stock_tree_div'),
    useArrows: true,
    border: false,
    rootVisible: true,
    listeners: {
        itemclick: function (view, rec, item, index, eventObj) {
            document.getElementById("stock_div").innerHTML = rec.data.text;
        }
    }
});

Has anyone faced this problem?

Darin Kolev
  • 3,401
  • 13
  • 31
  • 46
BlackLine
  • 363
  • 1
  • 4
  • 10

2 Answers2

1

May be it's problem at your JSON. Is it include something like:

"leaf" : "true",
"expanded" : "true"

?

TheHorse
  • 2,787
  • 1
  • 23
  • 32
0

In my case this was caused by the fact that server response json contained parent node as a first element. So when I was expanding node 123, server was returning node 123 itself and then all of it's children.

Victor
  • 750
  • 9
  • 9