我在我的应用程序中使用了一个简单的treepanel,有时它会停止展开和取消展开节点,并显示下一个错误:
records[i] is undefined
http://localhost:8080/extjs/ext-all-debug.js
Line 58763我的代码非常简单:
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;
}
}
});有没有人遇到过这个问题?
发布于 2011-08-12 20:23:48
可能是你的JSON出了问题。它是否包含以下内容:
"leaf" : "true",
"expanded" : "true"发布于 2012-07-31 19:05:20
在我的例子中,这是因为服务器响应json将父节点作为第一个元素。因此,当我展开节点123时,服务器返回节点123本身,然后返回它的所有子节点。
https://stackoverflow.com/questions/7039639
复制相似问题