首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

小弟我被Dojo坑出翔

2013-12-23 
我被Dojo坑出翔坑尼玛爹的Dojo TreeObjectStoreModel.jsgetChildren: function(/*Object*/ parentItem, /*

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

热点排行