Wait for callback in canExecute
Hi,
I have a feature action that I only want to enable if that feature has related records. The code below obviously does not work, becase the canExecute method does not wait for GetRelatedFeatures to finish.
Is there a way around this?
this.app.command("MyCommand").register(this,
(feature: geocortex.essentialsHtmlViewer.mapping.infrastructure.Feature) => {
// Execute the command
},
(feature: geocortex.essentialsHtmlViewer.mapping.infrastructure.Feature) => {
var oid = parseInt(feature.id.get());
this.app.command("GetRelatedFeatures").execute({
mapService: feature.layer.mapService,
relationshipId: 1,
objectId: oid,
successCallback: (results: esri.Graphic[]) => {
if (results.length > 0) {
// TODO
}
},
errorCallback: (error: Error) => { console.error(error.message); }
});
return false; // ??
});
0
Please sign in to leave a comment.
Comments
0 comments