Is it possible to send an ID to the Geometry Service so I know which callback links to the original request?
Yes you can send more information to the callback using the dojo command lang.partial.
This is a typical query task, which returns a result set:
var someVar = "Test";
listQueryDeferreds = listTask.execute(listQuery, function(results) {
// the code to process the results, someVar will be "Not Test" when this callback executes;
});
someVar = "Not Test";
Now with lang,partial
listQueryDeferreds = listTask.execute(listQuery, lang.partial( function(someVar, results) {
// the code to process the results. someVar will be "Test";
}, someVar ));
Jerry,
An inline function would simply be:
GeometryService.simplify([geoms],lang.hitch(this,function(sgeoms){ //do something with the sgeoms //because you used lang.hitch you have access to the scope of the //function that called this async result, which means //you have access to variables of the function that called this }),lang.hitch(this,function(err){ //do something }));
Thanks for your reply.
Can you provide an example of an inline function that does this?
You can do an inline function on the results of the geometryService or use the "then" word like in this Sample
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.