AnsweredAssumed Answered

identify task being executed in a  loop, breaks the dojo deferred addCallback

Question asked by ngalford on Jul 12, 2013
Latest reply on Jul 15, 2013 by kenbuja
I'm running a loop based on the currently visible layers to run an identify function for multiple layers simultaneously.  The identify task is working but I can't seem to get the deferred portion right.  I tried a .then vs addCallback but the return never updates the deferred object that the call is completed.  Any insight would be great.

idParams.geometry = evt.mapPoint;    idParams.mapExtent = map.extent;    var feature, lyrIdent = [];    for (var j = 0; j < ident.length; j++) {     if(ident[j].url != ""){      deferred = ident[1].execute(idParams);     }     deferred.then(function(response){      return, function(response){       var feature = response.feature;       lyrIdent.push(feature.attributes);       var template = new esri.InfoTemplate("#");       feature.setInfoTemplate(template);       return feature;      });     });    }    map.infoWindow.setFeatures([ deferred ]);;    console.log(lyrIdent); }