AnsweredAssumed Answered

dojo/promise/all not working with esri/request

Question asked by JALevine on Oct 5, 2015
Latest reply on Oct 5, 2015 by JALevine

This seems pretty straightforward, but I'm unable to get it to work.

 

I'd like to get the layer infos for selected layers in my map service using multiple esri/requests with a promise.  I have a visibleLayers array that I'm using to create each request:

<code>

var visibleLayers = [0,1];

var requestGroup = [];

array.forEach(visibleLayers, function(visibleLayer,i)

{

     var requestHandle = esriRequest(

     {

          url: dynamicLayer.url+"/"+visibleLayer,

          content: {f: "json"},

          callbackParamName: "callback"

     });

     requestGroup.push(requestHandle);

});

promises = all(requestGroup);

promises.then(processResults);

function processResults(results)

{

          //process results

}

</code>

 

Everything looks ok, but I never enter my processResults function.  I know that the return for esriRequest is deferred, so I'm not sure what's going wrong.

 

Any ideas?

 

Thanks,

Jason

Outcomes