我被Dojo坑出翔

坑尼玛爹的Dojo Tree
ObjectStoreModel.js

getChildren: function(/*Object*/ parentItem, /*function(items)*/ onComplete, /*function*/ onError){
               // summary:
               //          Calls onComplete() with array of child items of given parent item.
               // parentItem:
               //          Item from the dojo/store

               var id = this.store.getIdentity(parentItem);
               if(this.childrenCache[id]){
                    when(this.childrenCache[id], onComplete, onError);
                    return;
               }


看到没!这就是坑尼玛爹的dojo 干的好事!!!var id = this.store.getIdentity(parentItem);通过item对象获得id!!!注意,这里的id就是你对象里的id属性~就是这样{“id” : “1”},所以如果你的store里面有两个id为1的不同对象~即使他们是父子关系~如果你拿到的是父亲,那么恭喜你啦!this.childrenCache[id]会一直得到你自己!喜大普奔,你可以享受一次递归死循环了思密达~!!!!!!!

你可能感兴趣的:(JavaScript,dojo)