Extjs 4 treepanel bug
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: 'Па开发者_StackOverflow社区рки',
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?
May be it's problem at your JSON. Is it include something like:
"leaf" : "true",
"expanded" : "true"
?
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.
精彩评论