DOJO选择迭代项目

时间:2013-11-28 16:08:44

标签: javascript dojo

我的问题非常愚蠢,但我无法找到迭代Dojo Select项目的方法。我使用了以下功能之一:

             select.store.fetch({
                query:{id:'*'},
                onComplete:function(a,b,c){
                    dojo.forEach(a,function(item,index){
                        console.log(item.children);
                    })
                }
            });

但遗憾的是它不起作用。有人可以给我一些建议吗?

1 个答案:

答案 0 :(得分:1)

你可以这样说:

      selectWidget.store.fetch({
              //I am assuming you want everyting to come back so i left the query as empty that will get you everything back
                query: { },
                onComplete: function (items) { 
                // I would advice you to do a check here if items is empty or has value before the loop or anything to make sure things are in store just for debugging                    
                     dojo.forEach(items,function(item){
                    console.log(item.children);
                })
                }
            });