Select to view content in your preferred language

Cancel esri.request or stop callback from happening

1387
1
Jump to solution
03-01-2012 10:59 AM
MattMoyles
Occasional Contributor
In my project I have a dropdown list and when the user changes the value of this dropdown list an esri.request shoots out to get data. The problem is that sometimes a user will change the value of the dropdown box again before the callback from the last change comes back. Is there a way to stop the callback from happening if the user fires another request?

Is it possible to do something like this

var handle = esri.request({...});

//sometime later
handle.load = null;
0 Kudos
1 Solution

Accepted Solutions
nicogis
MVP Alum
esri.request return a dojo.Deferred
if you see you have a http://dojotoolkit.org/api/1.3/dojo/Deferred/cancel so in the chain you can cancel it.
see http://livedocs.dojotoolkit.org/dojo/Deferred

View solution in original post

0 Kudos
1 Reply
nicogis
MVP Alum
esri.request return a dojo.Deferred
if you see you have a http://dojotoolkit.org/api/1.3/dojo/Deferred/cancel so in the chain you can cancel it.
see http://livedocs.dojotoolkit.org/dojo/Deferred
0 Kudos