HTML5 Geocortex Commands
I am trying to create a custom search tool for the Geocortex HTML5 viewer version 2.3.
I need to be able to zoom to the features and am having trouble with the syntax for accessing built in geocortex commands in javascript code.
For example I want to use the 'ZoomToExtent"
I have tried something like this which works for custom commands that i have created but not for the geocortex commands :
this.app.commandRegistry.command("mapping.infrastucture.ZoomToExtent").execute(extent);
this.app.commandRegistry.command("ZoomToExtent").execute(extent);
I have also tried
mapping.infrastructure.zoomToExtent.execute(extent);
Any ideas???
Thanks,
Rob
-
After some further testing the following syntax works in a button handler that is bound to the html:
this.app.commandRegistry.command("ZoomToExtent").execute(extent);
However inside the handler i am calling the esri queryTask function and it would appear that the 'this' is going out of scope when the callback function is reached.
Not sure how to fix this?
0 -
If i create a variable to capture this and then nest the callback inside the main handler then it works.
ie
var _this = this;
queryTask.execute(query, showResults);
function show(results) {var extent = results.features[0].geometry.getExtent().expand(1.5);
_this.app.commandRegistry.command("ZoomToExtent").execute(extent);
}There must be a way to register a callback function somewhere?
0 -
try
queryTask.execute(query, this.showResults.bind(this));
Colin
0 -
A word of caution: "bind" is not supported in IE8. You might consider using dojo.hitch instead.
http://dojotoolkit.org/reference-guide/1.7/dojo/hitch.html
0 -
.bind works.
I will look into the dojo hitch method as well.
Thanks for the tips Colin and Alejandro!
0 -
Or better yet Latitude could implement the attributeSearch URL parameter from GVS!!
0 -
Hey, can someone confirm that this is correct and that attributeSearch is in fact not suported in HTML5 viewer? If so, then the online documenation needs to be corrected by Latitude since it implies that attributeSearch is indeed supported by BOTH by the Silverlight (GVS) and HTML5 (GVH) viewers (see screenshot below):
http://support.geocortex.com/how-to-perform-an-attribute-search-from-a-url
/customer/servlet/servlet.FileDownload?file=00P6000000em22iEAA
0
Please sign in to leave a comment.
Comments
7 comments