Lukasz Ciesluk
Lukasz Ciesluk

Reputation: 738

DOJO Select iterate throught items

My problem is very silly, but I can not find a way to iterate through Dojo Select items. I user one of this function :

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

but unfortunately it does not work. Can anyone give some advice for me ?

Upvotes: 0

Views: 443

Answers (1)

dori naji
dori naji

Reputation: 980

You can follow that:

      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);
                })
                }
            });

Upvotes: 1

Related Questions