2011-08-12 11 views
2

私は自分のアプリケーションのための単純なtreepanelを使用し、時にはそれが次のエラーでノードを展開し、unexpanding停止しますExtJSの4 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; 
     } 
    } 
}); 

を持っています誰もこの問題に直面した?

答えて

1

JSONで問題が発生することがあります。それには次のようなものが含まれていますか?

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

+0

はい、それは 'leaf'属性を含み、 'expanded'はオプションです。私は – BlackLine

+1

だと思います。つまり、leaf-itemsからすべての展開/展開を削除します。もし役に立たなかったら、あなたのjsonを投稿してください。 – TheHorse

+1

私は拡張属性を全く持っていません。 Jsonはかなり大きいです... – BlackLine

0

私の場合は、これは、サーバー応答jsonに親ノードが最初の要素として含まれていたためです。 ノード123を展開していたとき、サーバーはノード123自体を返していて、そのすべてが子ノードでした。