读书人

小弟我被Dojo坑出翔

发布时间: 2013-12-23 14:30:52 作者: rapoo

我被Dojo坑出翔
坑尼玛爹的Dojo Tree

ObjectStoreModel.jsgetChildren: 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]会一直得到你自己!喜大普奔,你可以享受一次递归死循环了思密达~!!!!!!!

读书人网 >Web前端

热点推荐